Btrfs: Release uuid_mutex for shrink during device delete
RFC PATCH 1/1 Btrfs: Release uuid_mutex for shrink during device delete
Device scanning waits on the uuid_mutex, which can result in a very long wait if dev delete is shrinking the device.
--- fs/btrfs/volumes.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/btrfs/volumes.c +2 -0
@@ -1468,7 +1468,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) clear_super = true; } +mutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 ); +mutex_lock (&uuid_mutex);if (ret) goto error_undo;
Signature · 1 line
1.7.0.4
fs/btrfs/volumes.c int btrfs_rm_device(struct btrfs_root *root, char *device_path) · line 1475
Quoted 8 lines · Carey Underwood
Device scanning waits on the
uuid_mutex, which can result in a very long wait if dev delete is shrinking the device.fs/btrfs/volumes.c +2
-0+mutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 ); +mutex_lock (&uuid_mutex);if (ret) goto error_undo;
I didn't find any problem with this change, but it's not quite clear to me what exactly does the uuid_mutex protect, so I've tried a best-guess approach and looked at all uses and git history. If there are multiple device rm operations called at the same time, they'll get serialized with the uuid mutex and the device count will be properly protected.
Consider it
david