linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, clm@fb.com,
	idryomov@gmail.com
Subject: Re: [PATCH] btrfs: fix a possible umount deadlock
Date: Sat, 10 Sep 2016 07:08:22 +0800	[thread overview]
Message-ID: <c10cc06b-1a4c-4000-12f4-5d19ba9f2754@oracle.com> (raw)
In-Reply-To: <20160909125313.GS16983@twin.jikos.cz>



On 09/09/2016 08:53 PM, David Sterba wrote:
> On Fri, Sep 09, 2016 at 04:31:04PM +0800, Anand Jain wrote:
>>  static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
>>  {
>>  	struct btrfs_device *device, *tmp;
>> +	static LIST_HEAD(pending_put);
>
> Why is it static?

  sorry my mistake its typo. v2 is sent out.

Thanks, Anand


>> +	INIT_LIST_HEAD(&pending_put);
>>
>>  	if (--fs_devices->opened > 0)
>>  		return 0;
>> @@ -906,9 +904,24 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
>>  	mutex_lock(&fs_devices->device_list_mutex);
>>  	list_for_each_entry_safe(device, tmp, &fs_devices->devices, dev_list) {
>>  		btrfs_close_one_device(device);
>> +		list_add(&device->dev_list, &pending_put);
>>  	}
>>  	mutex_unlock(&fs_devices->device_list_mutex);
>>
>> +	/*
>> +	 * btrfs_show_devname() is using the device_list_mutex,
>> +	 * sometimes a call to blkdev_put() leads vfs calling
>> +	 * into this func. So do put outside of device_list_mutex,
>> +	 * as of now.
>> +	 */
>> +	while (!list_empty(&pending_put)) {
>> +		device = list_entry(pending_put.next,
>> +					struct btrfs_device, dev_list);
>> +		list_del(&device->dev_list);
>> +		btrfs_close_bdev(device);
>> +		call_rcu(&device->rcu, free_device);
>> +	}
>> +
>>  	WARN_ON(fs_devices->open_devices);
>>  	WARN_ON(fs_devices->rw_devices);
>>  	fs_devices->opened = 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2016-09-09 23:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  8:31 [PATCH] btrfs: fix a possible umount deadlock Anand Jain
2016-09-09 12:53 ` David Sterba
2016-09-09 23:08   ` Anand Jain [this message]
2016-09-09 23:03 ` [PATCH v2] " Anand Jain
2016-09-21 14:26   ` David Sterba
2016-09-22  4:59     ` Anand Jain
2016-09-22  4:56 ` [PATCH v3] " Anand Jain
2016-09-22 15:35   ` David Sterba
2016-09-22 16:24   ` Jeff Mahoney
2016-10-03 16:20     ` 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=c10cc06b-1a4c-4000-12f4-5d19ba9f2754@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=idryomov@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).