All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, dsterba@suse.com
Subject: Re: [PATCH] btrfs: fix lockdep warning chunk_mutex vs device_list_mutex
Date: Sat, 16 May 2020 11:43:58 +0800	[thread overview]
Message-ID: <4fa7f041-5816-1d94-1148-780b10e705af@oracle.com> (raw)
In-Reply-To: <20200515174047.GN18421@twin.jikos.cz>

On 16/5/20 1:40 am, David Sterba wrote:
> 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.

Oh right the allocations. Its not just about the other locks
as I thought before.

There are two ways to fix.
   Use GFP_NOFS
    I am not yet sure if it not possible. There were some previous
    work on the GFP flags. I need to review them. or,
   Move the allocation outside the locks.

  Looking into both of these choices.

Thanks, Anand

> 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) {


  reply	other threads:[~2020-05-16  3:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 14:12 Pending bugs for 5.7 David Sterba
2020-05-12 14:14 ` Bug 5.7-rc: root leak, eb leak David Sterba
2020-05-12 23:03   ` David Sterba
2020-05-13 11:54     ` Johannes Thumshirn
2020-05-13 11:57       ` Qu Wenruo
2020-05-13 12:06         ` Johannes Thumshirn
2020-05-13 12:11           ` Qu Wenruo
2020-05-13 12:17             ` Johannes Thumshirn
2020-05-13 12:29               ` Johannes Thumshirn
2020-05-12 14:15 ` Bug 5.7-rc: write-time leaf corruption detected David Sterba
2020-05-12 14:26   ` Filipe Manana
2020-05-13  3:10   ` Qu Wenruo
2020-05-13  3:17     ` Qu Wenruo
2020-05-13  9:25     ` Filipe Manana
2020-05-19 14:26   ` Bug 5.7-rc: write-time leaf corruption detected (fixed) David Sterba
2020-05-12 14:15 ` Bug 5.7-rc: lockdep warning, chunk_mutex/device_list_mutex David Sterba
2020-05-12 23:28   ` David Sterba
2020-05-12 19:25     ` Anand Jain
2020-05-13 19:46   ` [PATCH] btrfs: fix lockdep warning chunk_mutex vs device_list_mutex Anand Jain
2020-05-15 17:40     ` David Sterba
2020-05-16  3:43       ` Anand Jain [this message]
2020-05-18 11:07         ` Anand Jain
2020-05-18 15:28           ` David Sterba
2020-05-12 14:15 ` Bug 5.7-rc: lockdep warning, fs_reclaim David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fa7f041-5816-1d94-1148-780b10e705af@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.