]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: unlink head after removing last namespace
authorKeith Busch <kbusch@kernel.org>
Thu, 9 Apr 2020 16:08:59 +0000 (09:08 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 9 May 2020 22:18:35 +0000 (16:18 -0600)
commit332e516fcd980994cc7bd014538302ffe10edca4
treea47aac514da6bebf108d485090baac5a9b44bc5b
parentb803e2ce70fc7d26a41813a3dee0dd4a1f8fcf94
nvme: unlink head after removing last namespace

The driver had been unlinking the namespace head from the subsystem's
list only after the last reference was released, and outside of the
list's subsys->lock protection.

There is no reason to track an empty head, so unlink the entry from the
subsystem's list when the last namespace using that head is removed and
with the mutex lock protecting the list update. The next namespace to
attach reusing the previous NSID will allocate a new head rather than
find the old head with mismatched identifiers.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c