Btrfs: fix a bug when opening seed devices
authorIlya Dryomov <idryomov@gmail.com>
Wed, 12 Oct 2011 21:20:43 +0000 (00:20 +0300)
committerDavid Sterba <dsterba@suse.cz>
Thu, 20 Oct 2011 16:20:36 +0000 (18:20 +0200)
Initialize fs_info->bdev_holder a bit earlier to be able to pass a
correct holder id to blkdev_get() when opening seed devices with O_EXCL.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/btrfs/super.c

index 09ce951666ea93c9ebb8d1bcc4cc5d1087b91b04..29eecbb6ec3a5ef21249d088b5dd9128197aaba6 100644 (file)
@@ -939,6 +939,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
 
                s->s_flags = flags | MS_NOSEC;
                strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
+               btrfs_sb(s)->fs_info->bdev_holder = fs_type;
                error = btrfs_fill_super(s, fs_devices, data,
                                         flags & MS_SILENT ? 1 : 0);
                if (error) {
@@ -946,7 +947,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
                        return ERR_PTR(error);
                }
 
-               btrfs_sb(s)->fs_info->bdev_holder = fs_type;
                s->s_flags |= MS_ACTIVE;
        }