Commit f106e82c authored by Li Zefan's avatar Li Zefan Committed by Chris Mason
Browse files

Btrfs: Fix a crash when mounting a subvolume

We should drop dentry before deactivating the superblock, otherwise
we can hit this bug:

BUG: Dentry f349a690{i=100,n=/} still in use (1) [unmount of btrfs loop1]

Steps to reproduce the bug:

  # mount /dev/loop1 /mnt
  # mkdir save
  # btrfs subvolume snapshot /mnt save/snap1
  # umount /mnt
  # mount -o subvol=save/snap1 /dev/loop1 /mnt
Reported-by: default avatarMichael Niederle <>
Signed-off-by: default avatarLi Zefan <>
Signed-off-by: default avatarChris Mason <>
parent 75eaa0e2
......@@ -685,9 +685,9 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
if (IS_ERR(new_root)) {
error = PTR_ERR(new_root);
goto error_free_subvol_name;
if (!new_root->d_inode) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment