All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] Btrfs: Release uuid_mutex for shrink during device delete
@ 2013-03-04 22:37 Carey Underwood
  2013-03-20 15:41 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Carey Underwood @ 2013-03-04 22:37 UTC (permalink / raw)
  To: linux-btrfs; +Cc: jbacik, idryomov, cwillu

Device scanning waits on the uuid_mutex, which can result in a very long
wait if dev delete is shrinking the device.

Signed-off-by: Carey Underwood <cwillu@cwillu.com>
---
 fs/btrfs/volumes.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5cce6aa..996af00 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -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;
 
-- 
1.7.0.4





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC][PATCH] Btrfs: Release uuid_mutex for shrink during device delete
  2013-03-04 22:37 [RFC][PATCH] Btrfs: Release uuid_mutex for shrink during device delete Carey Underwood
@ 2013-03-20 15:41 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2013-03-20 15:41 UTC (permalink / raw)
  To: Carey Underwood; +Cc: linux-btrfs, jbacik, idryomov, cwillu

On Mon, Mar 04, 2013 at 04:37:06PM -0600, Carey Underwood wrote:
> Device scanning waits on the uuid_mutex, which can result in a very long
> wait if dev delete is shrinking the device.
> 
> +	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
Reviewed-by: David Sterba <dsterba@suse.cz>


david

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-20 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 22:37 [RFC][PATCH] Btrfs: Release uuid_mutex for shrink during device delete Carey Underwood
2013-03-20 15:41 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.