diff --git a/src/kernel/core/fs/vfs.cpp b/src/kernel/core/fs/vfs.cpp index 50cb66d5e7..c25ddf7358 100755 --- a/src/kernel/core/fs/vfs.cpp +++ b/src/kernel/core/fs/vfs.cpp @@ -3386,8 +3386,9 @@ fs_unmount(char *path, bool kernel) goto err; } - /* grab the vnode master mutex to keep someone from creating a vnode - while we're figuring out if we can continue */ + /* grab the vnode master mutex to keep someone from creating + * a vnode while we're figuring out if we can continue + */ mutex_lock(&sVnodeMutex); /* simulate the root vnode having it's refcount decremented */ @@ -3415,6 +3416,9 @@ fs_unmount(char *path, bool kernel) } mount->unmounting = true; + /* add 2 back to the root vnode's ref */ + mount->root_vnode->ref_count += 2; + mutex_unlock(&sVnodeMutex); mount->covers_vnode->covered_by = NULL;