• Israel Rukshin's avatar
    nvme: fix subsystem multiple controllers support check · b837b283
    Israel Rukshin authored
    There is a problem when another module (e.g. nvmet) takes a reference on
    the nvme block device and the physical nvme drive is removed.  In that
    case nvme_free_ctrl() will not be called and the controller state will be
    "deleting" or "dead" unless nvmet module releases the block device.
    Later on, the same nvme drive probes back and nvme_init_subsystem() will
    be called and fail due to duplicate subnqn (if the nvme device doesn't
    support subsystem with multiple controllers). This will cause a probe
    failure.  This commit changes the check of multiple controllers support
    at nvme_init_subsystem() by not counting all the controllers at "dead" or
    "deleting" state (this is safe because controllers at this state will
    never be active again).
    
    Fixes: ab9e00cc ("nvme: track subsystems")
    Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
    Signed-off-by: default avatarIsrael Rukshin <israelr@mellanox.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    b837b283
core.c 88.3 KB