]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: avoid race in shutdown namespace removal
authorDaniel Wagner <dwagner@suse.de>
Thu, 2 Sep 2021 09:20:02 +0000 (11:20 +0200)
committerChristoph Hellwig <hch@lst.de>
Mon, 13 Sep 2021 15:04:04 +0000 (17:04 +0200)
commitfcf1bd7f0648477e644275da567a1940a71a054a
treea6e87f932394ccbc624e92414f4306d543f76af9
parent12560a3afc6317dea41e0b28ef6f20221a5359f2
nvme: avoid race in shutdown namespace removal

When we remove the siblings entry, we update ns->head->list, hence we
can't separate the removal and test for being empty. They have to be
in the same critical section to avoid a race.

To avoid breaking the refcounting imbalance again, add a list empty
check to nvme_find_ns_head.

Fixes: 279c8d3626d5 ("nvme: fix refcounting imbalance when all paths are down")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c