• Israel Rukshin's avatar
    nvme: Fix controller creation races with teardown flow · ce151813
    Israel Rukshin authored
    Calling nvme_sysfs_delete() when the controller is in the middle of
    creation may cause several bugs. If the controller is in NEW state we
    remove delete_controller file and don't delete the controller. The user
    will not be able to use nvme disconnect command on that controller again,
    although the controller may be active. Other bugs may happen if the
    controller is in the middle of create_ctrl callback and
    nvme_do_delete_ctrl() starts. For example, freeing I/O tagset at
    nvme_do_delete_ctrl() before it was allocated at create_ctrl callback.
    
    To fix all those races don't allow the user to delete the controller
    before it was fully created.
    Signed-off-by: default avatarIsrael Rukshin <israelr@mellanox.com>
    Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
    ce151813
nvme.h 17.3 KB