All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set
@ 2016-11-03 21:17 Sagi Grimberg
  2016-11-04  0:01 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2016-11-03 21:17 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>
---
 drivers/nvme/target/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 4d5be2de25f5..ffc8445a1ac3 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -840,7 +840,9 @@ static void nvmet_fatal_error_handler(struct work_struct *work)
 
 void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl)
 {
-	ctrl->csts |= NVME_CSTS_CFS;
+	if (test_and_set_bit(NVME_CSTS_CFS, (unsigned long *)&ctrl->csts))
+		return;
+
 	INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler);
 	schedule_work(&ctrl->fatal_err_work);
 }
-- 
2.7.4

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

* [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-03 21:17 [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set Sagi Grimberg
@ 2016-11-04  0:01 ` Christoph Hellwig
  2016-11-04  0:13   ` Sagi Grimberg
  2016-11-04 15:54   ` J Freyensee
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-11-04  0:01 UTC (permalink / raw)


>  {
> -	ctrl->csts |= NVME_CSTS_CFS;
> +	if (test_and_set_bit(NVME_CSTS_CFS, (unsigned long *)&ctrl->csts))
> +		return;
> +

This can't work - test_and_set_bit takes a bit index and NVME_CSTS_CFS
is the actual value.  I think we'll need a lock to protect ->csts
instead.

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

* [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-04  0:01 ` Christoph Hellwig
@ 2016-11-04  0:13   ` Sagi Grimberg
  2016-11-04 14:25     ` Steve Wise
  2016-11-04 15:54   ` J Freyensee
  1 sibling, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2016-11-04  0:13 UTC (permalink / raw)



>>  {
>> -	ctrl->csts |= NVME_CSTS_CFS;
>> +	if (test_and_set_bit(NVME_CSTS_CFS, (unsigned long *)&ctrl->csts))
>> +		return;
>> +
>
> This can't work - test_and_set_bit takes a bit index and NVME_CSTS_CFS
> is the actual value.  I think we'll need a lock to protect ->csts
> instead.

Oops... it still prevents from fatal_err work from requeueing
so at least I got 50% :)

I'll send a proper patch with a lock in place...

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

* [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-04  0:13   ` Sagi Grimberg
@ 2016-11-04 14:25     ` Steve Wise
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2016-11-04 14:25 UTC (permalink / raw)


> >>  {
> >> -	ctrl->csts |= NVME_CSTS_CFS;
> >> +	if (test_and_set_bit(NVME_CSTS_CFS, (unsigned long *)&ctrl->csts))
> >> +		return;
> >> +
> >
> > This can't work - test_and_set_bit takes a bit index and NVME_CSTS_CFS
> > is the actual value.  I think we'll need a lock to protect ->csts
> > instead.
> 
> Oops... it still prevents from fatal_err work from requeueing
> so at least I got 50% :)
> 
> I'll send a proper patch with a lock in place...
> 

I wonder if this is causing my most recent target crashes during kato
reconnect/recovery testing?

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

* [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set
  2016-11-04  0:01 ` Christoph Hellwig
  2016-11-04  0:13   ` Sagi Grimberg
@ 2016-11-04 15:54   ` J Freyensee
  1 sibling, 0 replies; 5+ messages in thread
From: J Freyensee @ 2016-11-04 15:54 UTC (permalink / raw)


On Fri, 2016-11-04@01:01 +0100, Christoph Hellwig wrote:
> > 
> > ?{
> > -	ctrl->csts |= NVME_CSTS_CFS;
> > +	if (test_and_set_bit(NVME_CSTS_CFS, (unsigned long
> > *)&ctrl->csts))
> > +		return;
> > +
> 
> This can't work - test_and_set_bit takes a bit index and
> NVME_CSTS_CFS
> is the actual value.??I think we'll need a lock to protect ->csts
> instead.

Yeah, I agree, it feels more like a lock solution.

> 
> 
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2016-11-04 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 21:17 [PATCH] nvmet: Don't queue fatal error work if csts.cfs is set Sagi Grimberg
2016-11-04  0:01 ` Christoph Hellwig
2016-11-04  0:13   ` Sagi Grimberg
2016-11-04 14:25     ` Steve Wise
2016-11-04 15:54   ` 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.