]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: fix refcounting imbalance when all paths are down
authorHannes Reinecke <hare@suse.de>
Fri, 16 Jul 2021 11:30:35 +0000 (13:30 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 21 Jul 2021 07:55:40 +0000 (09:55 +0200)
commit5396fdac56d87d04e75e5068c0c92d33625f51e7
treee408a4a51c5cb8346153afededaf514483374a46
parent7764656b108cd308c39e9a8554353b8f9ca232a3
nvme: fix refcounting imbalance when all paths are down

When the last path to a ns_head drops the current code
removes the ns_head from the subsystem list, but will only
delete the disk itself if the last reference to the ns_head
drops. This is causing an refcounting imbalance eg when
applications have a reference to the disk, as then they'll
never get notified that the disk is in fact dead.
This patch moves the call 'del_gendisk' into nvme_mpath_check_last_path(),
ensuring that the disk can be properly removed and applications get the
appropriate notifications.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h