Skip to content

Commit ea3442e

Browse files
Ewan D. Milnekeithbusch
authored andcommitted
nvme: nvme-fc: move tagset removal to nvme_fc_delete_ctrl()
Now target is removed from nvme_fc_ctrl_free() which is the ctrl->ref release handler. And even admin queue is unquiesced there, this way is definitely wrong because the ctr->ref is grabbed when submitting command. And Marco observed that nvme_fc_ctrl_free() can be called from request completion code path, and trigger kernel warning since request completes from softirq context. Fix the issue by moveing target removal into nvme_fc_delete_ctrl(), which is also aligned with nvme-tcp and nvme-rdma. Patch originally proposed by Ming Lei, then modified to move the tagset removal down to after nvme_fc_delete_association() after further testing. Cc: Marco Patalano <[email protected]> Cc: Ewan Milne <[email protected]> Cc: James Smart <[email protected]> Cc: Sagi Grimberg <[email protected]> Signed-off-by: Ming Lei <[email protected]> Cc: [email protected] Tested-by: Marco Patalano <[email protected]> Reviewed-by: Justin Tee <[email protected]> Signed-off-by: Ewan D. Milne <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 6d87cd5 commit ea3442e

File tree

1 file changed

+7
-6
lines changed
  • drivers/nvme/host

1 file changed

+7
-6
lines changed

drivers/nvme/host/fc.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,17 +2355,11 @@ nvme_fc_ctrl_free(struct kref *ref)
23552355
container_of(ref, struct nvme_fc_ctrl, ref);
23562356
unsigned long flags;
23572357

2358-
if (ctrl->ctrl.tagset)
2359-
nvme_remove_io_tag_set(&ctrl->ctrl);
2360-
23612358
/* remove from rport list */
23622359
spin_lock_irqsave(&ctrl->rport->lock, flags);
23632360
list_del(&ctrl->ctrl_list);
23642361
spin_unlock_irqrestore(&ctrl->rport->lock, flags);
23652362

2366-
nvme_unquiesce_admin_queue(&ctrl->ctrl);
2367-
nvme_remove_admin_tag_set(&ctrl->ctrl);
2368-
23692363
kfree(ctrl->queues);
23702364

23712365
put_device(ctrl->dev);
@@ -3261,11 +3255,18 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
32613255

32623256
cancel_work_sync(&ctrl->ioerr_work);
32633257
cancel_delayed_work_sync(&ctrl->connect_work);
3258+
32643259
/*
32653260
* kill the association on the link side. this will block
32663261
* waiting for io to terminate
32673262
*/
32683263
nvme_fc_delete_association(ctrl);
3264+
3265+
if (ctrl->ctrl.tagset)
3266+
nvme_remove_io_tag_set(&ctrl->ctrl);
3267+
3268+
nvme_unquiesce_admin_queue(&ctrl->ctrl);
3269+
nvme_remove_admin_tag_set(&ctrl->ctrl);
32693270
}
32703271

32713272
static void

0 commit comments

Comments
 (0)