All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] nvmet: Don't queue fatal error work if csts.cfs is set
@ 2016-11-06  9:16 Sagi Grimberg
  2016-11-06 16:41 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2016-11-06  9:16 UTC (permalink / raw)


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(+)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 7c0fe31ee654..3903150c489a 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -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);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-06  9:16 [PATCH v1] nvmet: Don't queue fatal error work if csts.cfs is set Sagi Grimberg
@ 2016-11-06 16:41 ` Christoph Hellwig
  2016-11-07 18:07   ` J Freyensee
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-11-06 16:41 UTC (permalink / raw)


On Sun, Nov 06, 2016@11:16:18AM +0200, Sagi Grimberg wrote:
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-06 16:41 ` Christoph Hellwig
@ 2016-11-07 18:07   ` J Freyensee
  0 siblings, 0 replies; 3+ messages in thread
From: J Freyensee @ 2016-11-07 18:07 UTC (permalink / raw)


On Sun, 2016-11-06@17:41 +0100, Christoph Hellwig wrote:
> On Sun, Nov 06, 2016@11:16:18AM +0200, Sagi Grimberg wrote:
> > 
> > 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>


> 
> Reviewed-by: Christoph Hellwig <hch at lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-07 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-06  9:16 [PATCH v1] nvmet: Don't queue fatal error work if csts.cfs is set Sagi Grimberg
2016-11-06 16:41 ` Christoph Hellwig
2016-11-07 18:07   ` J Freyensee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.