public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Niels Dossche <dossche.niels@gmail.com>
To: Sagi Grimberg <sagi@grimberg.me>, linux-nvme@lists.infradead.org
Cc: Christoph Hellwig <hch@lst.de>,
	Chaitanya Kulkarni <kch@nvidia.com>,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH v3] nvmet: add missing lock around nvmet_ns_changed in nvmet_ns_revalidate
Date: Mon, 14 Mar 2022 00:32:28 +0100	[thread overview]
Message-ID: <9a5808b4-275d-6348-990e-23b0c5eae5e3@gmail.com> (raw)
In-Reply-To: <d5b1b564-cad6-87c2-11e8-f2d9d92f389c@grimberg.me>

On 3/13/22 21:41, Sagi Grimberg wrote:
> 
>>>> My commit message in v2 did not clearly state that nvmet_ns_revalidate has 3 callers, of which
>>>> 2 do not acquire that lock: nvmet_execute_identify_cns_cs_ns and nvmet_execute_identify_ns. The other caller
>>>> nvmet_ns_revalidate_size_store does acquire the lock. Maybe I caused some confusion because of the unclear wording.
>>>
>>> It is simpler to just move that call-site outside of the lock imo.
>>
>> The callsite that has the lock is nvmet_ns_revalidate_size_store. It checks for the enabled flag under that lock.
>> If nvmet_ns_revalidate_size_store calls nvmet_ns_revalidate without that lock taken, but with the lock acquired inside the nvmet_ns_revalidate_size_store function itself, is it not possible that the ns->enabled flag changes in between the ns->enabled check and the call to nvmet_ns_revalidate_size_store? I thought the locking in that function was to also make sure that the enabled flag does not change during the execution of nvmet_ns_revalidate?
> 
> The lock just protects subsys->ctrls traversal, can't see any
> harm with sending 2 aens out of order, twice...
> 

I understand, thanks. I'll send a patch.


      reply	other threads:[~2022-03-13 23:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 12:51 [PATCH v3] nvmet: add missing lock around nvmet_ns_changed in nvmet_ns_revalidate Niels Dossche
2022-03-13 13:03 ` Sagi Grimberg
2022-03-13 13:14   ` Niels Dossche
2022-03-13 13:31     ` Sagi Grimberg
2022-03-13 13:50       ` Niels Dossche
2022-03-13 20:41         ` Sagi Grimberg
2022-03-13 23:32           ` Niels Dossche [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=9a5808b4-275d-6348-990e-23b0c5eae5e3@gmail.com \
    --to=dossche.niels@gmail.com \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=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