Re: [PATCH] btrfs: fix lockdep warning chunk_mutex vs device_list_mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 14, 2020 at 03:46:59AM +0800, Anand Jain wrote:
> A full list of tests just started.
> 
>  fs/btrfs/volumes.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 60ab41c12e50..ebc8565d0f73 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -984,7 +984,6 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig)
>  	if (IS_ERR(fs_devices))
>  		return fs_devices;
>  

So now here's the device_list_mutex taken by a caller but inside
clone_fs_devices there's

	fs_devices = alloc_fs_devices(orig->fsid, NULL);

just before this line and it does a GFP_KERNEL allocation. This could
deadlock through the allocator trying to flush data and then superblock
write locking the device_list_mutex again.

> -	mutex_lock(&orig->device_list_mutex);
>  	fs_devices->total_devices = orig->total_devices;
>  
>  	list_for_each_entry(orig_dev, &orig->devices, dev_list) {



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux