Commit 36715cf4 authored by James Smart's avatar James Smart Committed by Jens Axboe

nvme_fc: replace ioabort msleep loop with completion

Per the recommendation by Sagi on:
http://lists.infradead.org/pipermail/linux-nvme/2017-April/009261.html

Wait for io aborts to complete wait converted from msleep look to
using a struct completion.
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b4dfd6ee
...@@ -166,6 +166,7 @@ struct nvme_fc_ctrl { ...@@ -166,6 +166,7 @@ struct nvme_fc_ctrl {
struct kref ref; struct kref ref;
u32 flags; u32 flags;
u32 iocnt; u32 iocnt;
wait_queue_head_t ioabort_wait;
struct nvme_fc_fcp_op aen_ops[NVME_FC_NR_AEN_COMMANDS]; struct nvme_fc_fcp_op aen_ops[NVME_FC_NR_AEN_COMMANDS];
...@@ -1239,8 +1240,10 @@ __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl, ...@@ -1239,8 +1240,10 @@ __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl,
spin_lock_irqsave(&ctrl->lock, flags); spin_lock_irqsave(&ctrl->lock, flags);
if (unlikely(op->flags & FCOP_FLAGS_TERMIO)) { if (unlikely(op->flags & FCOP_FLAGS_TERMIO)) {
if (ctrl->flags & FCCTRL_TERMIO) if (ctrl->flags & FCCTRL_TERMIO) {
ctrl->iocnt--; if (!--ctrl->iocnt)
wake_up(&ctrl->ioabort_wait);
}
} }
if (op->flags & FCOP_FLAGS_RELEASED) if (op->flags & FCOP_FLAGS_RELEASED)
complete_rq = true; complete_rq = true;
...@@ -2476,11 +2479,7 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) ...@@ -2476,11 +2479,7 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)
/* wait for all io that had to be aborted */ /* wait for all io that had to be aborted */
spin_lock_irqsave(&ctrl->lock, flags); spin_lock_irqsave(&ctrl->lock, flags);
while (ctrl->iocnt) { wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock);
spin_unlock_irqrestore(&ctrl->lock, flags);
msleep(1000);
spin_lock_irqsave(&ctrl->lock, flags);
}
ctrl->flags &= ~FCCTRL_TERMIO; ctrl->flags &= ~FCCTRL_TERMIO;
spin_unlock_irqrestore(&ctrl->lock, flags); spin_unlock_irqrestore(&ctrl->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment