Skip to content

Commit 20c5bbc

Browse files
committed
btrfs: restore uuid_mutex in btrfs_open_devices
Commit 542c590 ("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: 542c590 ("btrfs: replace uuid_mutex by device_list_mutex in btrfs_open_devices") Reviewed-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent e4e7ede commit 20c5bbc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/volumes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
11461146
{
11471147
int ret;
11481148

1149+
mutex_lock(&uuid_mutex);
11491150
mutex_lock(&fs_devices->device_list_mutex);
11501151
if (fs_devices->opened) {
11511152
fs_devices->opened++;
@@ -1155,6 +1156,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
11551156
ret = open_fs_devices(fs_devices, flags, holder);
11561157
}
11571158
mutex_unlock(&fs_devices->device_list_mutex);
1159+
mutex_unlock(&uuid_mutex);
11581160

11591161
return ret;
11601162
}

0 commit comments

Comments
 (0)