summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba2018-06-19 17:09:47 +0200
committerDavid Sterba2018-08-06 13:12:47 +0200
commitf5194e34cabaddd348a90f950e0a8188dd26cdc0 (patch)
tree8a7b478717ccb4bb87575d1594d437adebb552e3 /fs/btrfs/volumes.c
parentbtrfs: lift uuid_mutex to callers of btrfs_scan_one_device (diff)
downloadkernel-qcow2-linux-f5194e34cabaddd348a90f950e0a8188dd26cdc0.tar.gz
kernel-qcow2-linux-f5194e34cabaddd348a90f950e0a8188dd26cdc0.tar.xz
kernel-qcow2-linux-f5194e34cabaddd348a90f950e0a8188dd26cdc0.zip
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 <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index df5dd6f67887..459cc2a2a31c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1142,7 +1142,8 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
{
int ret;
- mutex_lock(&uuid_mutex);
+ lockdep_assert_held(&uuid_mutex);
+
mutex_lock(&fs_devices->device_list_mutex);
if (fs_devices->opened) {
fs_devices->opened++;
@@ -1152,7 +1153,6 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
ret = open_fs_devices(fs_devices, flags, holder);
}
mutex_unlock(&fs_devices->device_list_mutex);
- mutex_unlock(&uuid_mutex);
return ret;
}