Re: [PATCH RFC 2/3] btrfs: consolidate device_list_mutex in prepare_sprout to its parent
From: Su Yue <hidden>
Date: 2021-08-21 14:58:33
On Fri 20 Aug 2021 at 16:53, Anand Jain [off-list ref] wrote:
quoted
quoted
@@ -2366,6 +2366,8 @@ static int btrfs_prepare_sprout(structbtrfs_fs_info *fs_info) u64 super_flags; lockdep_assert_held(&uuid_mutex); + lockdep_assert_held(&fs_devices->device_list_mutex); +Just a reminder: clone_fs_devices() still takes the mutex in misc-next.As I am checking clone_fs_devices() does not take any lock. Could you pls recheck?
Hmmmm... misc-next: https://github.com/kdave/btrfs-devel/blob/e05983195f31374ad51a0f3712efec381397f3cb/fs/btrfs/volumes.c#L381 -- Su
quoted
quoted
@@ -2588,6 +2588,7 @@ int btrfs_init_new_device(structbtrfs_fs_info *fs_info, const char *device_path device->dev_stats_valid = 1; set_blocksize(device->bdev, BTRFS_BDEV_BLOCKSIZE); + mutex_lock(&fs_devices->device_list_mutex); if (seeding_dev) { btrfs_clear_sb_rdonly(sb); ret = btrfs_prepare_sprout(fs_info);the erorr case: if (ret) { mutex_unlock(&fs_devices->device_list_mutex); ... }Right. I missed it will fix. Thanks.