Skip to content

Commit b63de84

Browse files
James SmartChristoph Hellwig
authored andcommitted
nvme: Revert: Fix controller creation races with teardown flow
The indicated patch introduced a barrier in the sysfs_delete attribute for the controller that rejects the request if the controller isn't created. "Created" is defined as at least 1 call to nvme_start_ctrl(). This is problematic in error-injection testing. If an error occurs on the initial attempt to create an association and the controller enters reconnect(s) attempts, the admin cannot delete the controller until either there is a successful association created or ctrl_loss_tmo times out. Where this issue is particularly hurtful is when the "admin" is the nvme-cli, it is performing a connection to a discovery controller, and it is initiated via auto-connect scripts. With the FC transport, if the first connection attempt fails, the controller enters a normal reconnect state but returns control to the cli thread that created the controller. In this scenario, the cli attempts to read the discovery log via ioctl, which fails, causing the cli to see it as an empty log and then proceeds to delete the discovery controller. The delete is rejected and the controller is left live. If the discovery controller reconnect then succeeds, there is no action to delete it, and it sits live doing nothing. Cc: <stable@vger.kernel.org> # v5.7+ Fixes: ce15181 ("nvme: Fix controller creation races with teardown flow") Signed-off-by: James Smart <james.smart@broadcom.com> CC: Israel Rukshin <israelr@mellanox.com> CC: Max Gurtovoy <maxg@mellanox.com> CC: Christoph Hellwig <hch@lst.de> CC: Keith Busch <kbusch@kernel.org> CC: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 88ce2a5 commit b63de84

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

drivers/nvme/host/core.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,10 +3525,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
35253525
{
35263526
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
35273527

3528-
/* Can't delete non-created controllers */
3529-
if (!ctrl->created)
3530-
return -EBUSY;
3531-
35323528
if (device_remove_file_self(dev, attr))
35333529
nvme_delete_ctrl_sync(ctrl);
35343530
return count;
@@ -4403,7 +4399,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
44034399
nvme_queue_scan(ctrl);
44044400
nvme_start_queues(ctrl);
44054401
}
4406-
ctrl->created = true;
44074402
}
44084403
EXPORT_SYMBOL_GPL(nvme_start_ctrl);
44094404

drivers/nvme/host/nvme.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ struct nvme_ctrl {
307307
struct nvme_command ka_cmd;
308308
struct work_struct fw_act_work;
309309
unsigned long events;
310-
bool created;
311310

312311
#ifdef CONFIG_NVME_MULTIPATH
313312
/* asymmetric namespace access: */

0 commit comments

Comments
 (0)