linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH] nvmet: Fix possible infinite loop triggered on hot namespace removal
Date: Tue, 1 Nov 2016 16:37:01 +0200	[thread overview]
Message-ID: <c94dab5e-cf77-b376-e1e0-3950be525e96@grimberg.me> (raw)
In-Reply-To: <20161101134352.GA5096@infradead.org>


>>  void nvmet_ns_disable(struct nvmet_ns *ns)
>> @@ -324,13 +324,10 @@ void nvmet_ns_disable(struct nvmet_ns *ns)
>>  	struct nvmet_subsys *subsys = ns->subsys;
>>  	struct nvmet_ctrl *ctrl;
>>
>> -	mutex_lock(&subsys->lock);
>> -	if (list_empty(&ns->dev_link)) {
>> -		mutex_unlock(&subsys->lock);
>> +	if (!test_and_clear_bit(NVMET_NS_ENABLED, &ns->flags))
>>  		return;
>> -	}
>> -	list_del_init(&ns->dev_link);
>> -	mutex_unlock(&subsys->lock);
>> +
>> +	list_del_rcu(&ns->dev_link);
>
> We'll still need the lock here, don't we?

we do... And we also need to protect with the subsys lock on
nvmet_ns_disable as a whole against concurrent enable/disable (unless
we want to add a new lock to nvmet_ns)

      reply	other threads:[~2016-11-01 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30  9:22 [PATCH] nvmet: Fix possible infinite loop triggered on hot namespace removal Sagi Grimberg
2016-11-01 13:43 ` Christoph Hellwig
2016-11-01 14:37   ` 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=c94dab5e-cf77-b376-e1e0-3950be525e96@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).