[PATCH] nvmet: fix ns enable/disable possible hang
Christoph Hellwig
hch at lst.de
Tue May 21 12:39:06 PDT 2024
On Tue, May 21, 2024 at 11:56:23AM +0300, Sagi Grimberg wrote:
> When disabling an nvmet namespace, there is a period where
> the subsys->lock is released, as the ns disable waits for
> backend IO to complete, and the ns percpu ref to be properly
> killed. The original intent was to avoid taking the subsystem
> lock for a prolong period as other processes may need to acquire
> it (for example new incoming connections).
>
> However, it opens up a window where another process may come in
> and enable the ns, (re)intiailizing the ns percpu_ref, causing
> the disable sequence to hang.
>
> Solve this by taking the global nvmet_config_sem over the entire
> configfs enable/disable sequence.
Can you use up all 73 characters for the commit log and add a little
comment to the code on why nvmet_config_sem is taken to the code?
With that this looks good to me.
More information about the Linux-nvme
mailing list