From f5194e34cabaddd348a90f950e0a8188dd26cdc0 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 19 Jun 2018 17:09:47 +0200 Subject: btrfs: lift uuid_mutex to callers of btrfs_open_devices Prepartory work to fix race between mount and device scan. The callers will have to manage the critical section, eg. mount wants to scan and then call btrfs_open_devices without the ioctl scan walking in and modifying the fs devices in the meantime. Reviewed-by: Anand Jain Signed-off-by: David Sterba --- fs/btrfs/super.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/btrfs/super.c') diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 0b6567f0c63d..d470eb6b9226 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1567,7 +1567,9 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type, goto error_fs_info; } + mutex_lock(&uuid_mutex); error = btrfs_open_devices(fs_devices, mode, fs_type); + mutex_unlock(&uuid_mutex); if (error) goto error_fs_info; -- cgit v1.2.3