Re: [PATCH 5/5] btrfs: move uuid_mutex closer to exclusivity

2018-01-09 Thread Anand Jain



On 01/10/2018 12:15 AM, Josef Bacik wrote:

On Tue, Jan 09, 2018 at 10:46:25PM +0800, Anand Jain wrote:

move uuid_mutex with in device_list_add().

Signed-off-by: Anand Jain 


This isn't going to work, there's a bunch of places we return errors so this
just deadlocks the box.  Leave it like it is, it's not hurting anybody leaving
it like this.  Thanks,


 Err. My mistake. Can't believe how did I miss it.
 Pls ignore this patch.
 Thanks for the review.

- Anand


Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] btrfs: move uuid_mutex closer to exclusivity

2018-01-09 Thread Josef Bacik
On Tue, Jan 09, 2018 at 10:46:25PM +0800, Anand Jain wrote:
> move uuid_mutex with in device_list_add().
> 
> Signed-off-by: Anand Jain 

This isn't going to work, there's a bunch of places we return errors so this
just deadlocks the box.  Leave it like it is, it's not hurting anybody leaving
it like this.  Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] btrfs: move uuid_mutex closer to exclusivity

2018-01-09 Thread Anand Jain
move uuid_mutex with in device_list_add().

Signed-off-by: Anand Jain 
---
 fs/btrfs/volumes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index f942e8193862..283417bf3b00 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -740,6 +740,7 @@ static noinline int device_list_add(const char *path,
u64 found_transid = btrfs_super_generation(disk_super);
u64 devid = btrfs_stack_device_id(&disk_super->dev_item);
 
+   mutex_lock(&uuid_mutex);
fs_devices = find_fsid(disk_super->fsid);
if (!fs_devices) {
fs_devices = alloc_fs_devices(disk_super->fsid);
@@ -847,6 +848,8 @@ static noinline int device_list_add(const char *path,
 
fs_devices->total_devices = btrfs_super_num_devices(disk_super);
 
+   mutex_unlock(&uuid_mutex);
+
*device_ret = device;
 
return 0;
@@ -1208,9 +1211,7 @@ int btrfs_scan_one_device(const char *path, fmode_t 
flags, void *holder,
goto error_bdev_put;
}
 
-   mutex_lock(&uuid_mutex);
ret = device_list_add(path, disk_super, &device);
-   mutex_unlock(&uuid_mutex);
 
*fs_devices_ret = device->fs_devices;
 
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html