aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2018-06-20 13:51:28 -0400
committerDavid Sterba <dsterba@suse.com>2018-07-13 08:55:46 -0400
commit20c5bbc640cdf8e23947990ab98f5ba950a3e1b0 (patch)
tree18582dc8644adb26d941e2e74fb4cfc53bed0986
parente4e7ede739f7fb468686dfffa2d1e35dca35bacd (diff)
btrfs: restore uuid_mutex in btrfs_open_devices
Commit 542c5908abfe84f7b4c1 ("btrfs: replace uuid_mutex by device_list_mutex in btrfs_open_devices") switched to device_list_mutex as we need that for the device list traversal, but we also need uuid_mutex to protect access to fs_devices::opened to be consistent with other users of that. Fixes: 542c5908abfe84f7b4c1 ("btrfs: replace uuid_mutex by device_list_mutex in btrfs_open_devices") Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/volumes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index e034ad9e23b4..1da162928d1a 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1146,6 +1146,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
1146{ 1146{
1147 int ret; 1147 int ret;
1148 1148
1149 mutex_lock(&uuid_mutex);
1149 mutex_lock(&fs_devices->device_list_mutex); 1150 mutex_lock(&fs_devices->device_list_mutex);
1150 if (fs_devices->opened) { 1151 if (fs_devices->opened) {
1151 fs_devices->opened++; 1152 fs_devices->opened++;
@@ -1155,6 +1156,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
1155 ret = open_fs_devices(fs_devices, flags, holder); 1156 ret = open_fs_devices(fs_devices, flags, holder);
1156 } 1157 }
1157 mutex_unlock(&fs_devices->device_list_mutex); 1158 mutex_unlock(&fs_devices->device_list_mutex);
1159 mutex_unlock(&uuid_mutex);
1158 1160
1159 return ret; 1161 return ret;
1160} 1162}