linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v2] nvmet: Fix possible infinite loop triggered on hot namespace removal
Date: Thu, 3 Nov 2016 23:20:43 +0200	[thread overview]
Message-ID: <b80d19a9-267d-d5cf-dcbb-b678e9624e15@grimberg.me> (raw)
In-Reply-To: <20161102144045.GB13577@lst.de>


>> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
>> index 6559d5afa7bf..bf36d2486245 100644
>> --- a/drivers/nvme/target/core.c
>> +++ b/drivers/nvme/target/core.c
>> @@ -264,9 +264,11 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
>>  	int ret = 0;
>>
>>  	mutex_lock(&subsys->lock);
>> -	if (!list_empty(&ns->dev_link))
>> +	if (ns->enabled)
>>  		goto out_unlock;
>>
>> +	ns->enabled = true;
>> +
>>  	ns->bdev = blkdev_get_by_path(ns->device_path, FMODE_READ | FMODE_WRITE,
>>  			NULL);
>>  	if (IS_ERR(ns->bdev)) {
>
> This will leave the enable flag set when an error happen? later,
> won't it?  I'd set it just before dropping the lock.

Yep, will do.

>
>>  static inline bool nvmet_ns_enabled(struct nvmet_ns *ns)
>>  {
>> -	return !list_empty_careful(&ns->dev_link);
>> +	return ns->enabled;
>
> and we can probably kill this helper, it's pretty pointless
> now.

I will.

      reply	other threads:[~2016-11-03 21:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 15:54 [PATCH v2] nvmet: Fix possible infinite loop triggered on hot namespace removal Sagi Grimberg
2016-11-02 14:40 ` Christoph Hellwig
2016-11-03 21:20   ` Sagi Grimberg [this message]

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=b80d19a9-267d-d5cf-dcbb-b678e9624e15@grimberg.me \
    --to=sagi@grimberg.me \
    /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).