Skip to contentSkip to conversation

nvmet: Don't queue fatal error work if csts.cfs is set

PATCH Superseded Sagi Grimberg 3 participants 3 messages Nov 6, 2016 – Nov 7, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvmet: Don't queue fatal error work if csts.cfs is set

In the transport, in case of an interal queue error like error completion in rdma we trigger a fatal error. However, multiple queues in the same controller can serr error completions and we don't want to trigger fatal error work more than once.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>

---
Changes from v0:
- protect with ctrl lock instead of abusing atomic bitops on ctrl->csts

 drivers/nvme/target/core.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/nvme/target/core.c +6 -0
index 7c0fe31ee654..3903150c489a 100644
@@ -840,9 +840,15 @@ static void nvmet_fatal_error_handler(struct work_struct *work)
 
 void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl)
 {
+	mutex_lock(&ctrl->lock);
+	if (ctrl->csts & NVME_CSTS_CFS)
+		goto out;
+
 	ctrl->csts |= NVME_CSTS_CFS;
 	INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler);
 	schedule_work(&ctrl->fatal_err_work);
+out:
+	mutex_unlock(&ctrl->lock);
 }
 EXPORT_SYMBOL_GPL(nvmet_ctrl_fatal_error);
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 nvmet: Don't queue fatal error work if csts.cfs is set

Quoted 6 lines · Sagi Grimberg

In the transport, in case of an interal queue error like error completion in rdma we trigger a fatal error. However, multiple queues in the same controller can serr error completions and we don't want to trigger fatal error work more than once.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>

Looks fine, although I'd avoid the goto and just use a if blocks for the rest of the action..

Reviewed-by Christoph Hellwig <hch at lst.de>
#2 lore raw

PATCH 1/1 nvmet: Don't queue fatal error work if csts.cfs is set

Quoted 11 lines · Christoph Hellwig
Quoted 7 lines · Sagi Grimberg

In the transport, in case of an interal queue error like error completion in rdma we trigger a fatal error. However, multiple queues in the same controller can serr error completions and we don't want to trigger fatal error work more than once.

Signed-off-by Sagi Grimberg <sagi at grimberg.me>

Looks fine, although I'd avoid the goto and just use a if blocks for the rest of the action..

I agree, this is such a short function, I would think the goto could be removed and still have an obvious yet easy to maintain error return path using basic if()/else().

But looks good otherwise.

Reviewed-by Jay Freyensee <james_p_freyensee at linux.intel.com>
Quoted 2 lines
Reviewed-by Christoph Hellwig <hch at lst.de>