[PATCH v2] nvmet: add missing locks around nvmet_ns_revalidate

Niels Dossche dossche.niels at gmail.com
Thu Mar 10 04:46:22 PST 2022


On 10/03/2022 07:38, Christoph Hellwig wrote:
> On Thu, Mar 10, 2022 at 02:25:11AM +0100, Niels Dossche wrote:
>> nvmet_ns_changed states via lockdep that the ns->subsys->lock must be
>> held. The only caller of nvmet_ns_changed which does not acquire that
>> lock is nvmet_ns_revalidate.
> 
> So acquire it in nvmet_ns_revalidate only when we actually call
> nvmet_ns_changed.  Otherwise we take a subsystem-wide lock for every
> Identify Namespace all.

There are 3 callers of nvmet_ns_revalidate, of which 2 do not acquire the lock and 1 does.
I'll send a v3 patch which does the locking locally inside that if check by adding an additional argument to indicate whether the lock should be acquired or not.
Thanks.



More information about the Linux-nvme mailing list