[PATCHv8] nvme: fix refcounting imbalance when all paths are down

Hannes Reinecke hare at suse.de
Tue Jul 13 02:37:58 PDT 2021


On 6/24/21 10:55 AM, Hannes Reinecke wrote:
> 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.
> 
> Changes to v7:
> - Move the list_del() call outside of nvme_mpath_check_last_path()
> Changes to v6:
> - Move the list_del() into nvme_mpath_check_last_path()
> - Drop the tests for GENHD_FL_UP
> Changes to v5:
> - Synchronize between nvme_init_ns_head() and nvme_mpath_check_last_path()
> - Check for removed gendisk in nvme_ns_head_submit_bio()
> Changes to v4:
> - Call del_gendisk() in nvme_mpath_check_last_path() to avoid deadlock
> Changes to v3:
> - Simplify if() clause to detect duplicate namespaces
> Changes to v2:
> - Drop memcpy() statement
> Changes to v1:
> - Always check NSIDs after reattach
> 
> Signed-off-by: Hannes Reinecke <hare at suse.de>
> ---
>  drivers/nvme/host/core.c      | 14 +++++++++++---
>  drivers/nvme/host/multipath.c | 11 +++++++++--
>  drivers/nvme/host/nvme.h      | 11 ++---------
>  3 files changed, 22 insertions(+), 14 deletions(-)
> 
Ping?
Any issues left to be resolved?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare at suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer



More information about the Linux-nvme mailing list