Skip to contentSkip to conversation

IB/core: Protect against self-requeue of a cq work item

PATCH New Sagi Grimberg 5 participants 5 messages Mar 8, 2017 – Mar 24, 2017

Subsystems (2)
lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 IB/core: Protect against self-requeue of a cq work item

We need to make sure that the cq work item does not run when we are destroying the cq. Unlike flush_work, cancel_work_sync protects against self-requeue of the work item (which we can do in ib_cq_poll_work).

Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/infiniband/core/cq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cq.c +1 -1
index e95510117a6d..2746d2eb3d52 100644
@@ -196,7 +196,7 @@ void ib_free_cq(struct ib_cq *cq)
 		irq_poll_disable(&cq->iop);
 		break;
 	case IB_POLL_WORKQUEUE:
-		flush_work(&cq->work);
+		cancel_work_sync(&cq->work);
 		break;
 	default:
 		WARN_ON_ONCE(1);
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 IB/core: Protect against self-requeue of a cq work item

Looks good,

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

PATCH 1/1 IB/core: Protect against self-requeue of a cq work item

In reply to Sagi Grimberg
Quoted 4 lines · Sagi Grimberg

We need to make sure that the cq work item does not run when we are destroying the cq. Unlike flush_work, cancel_work_sync protects against self-requeue of the work item (which we can do in ib_cq_poll_work).

Reviewed-by Bart Van Assche <bart.vanassche at sandisk.com>
#3 lore raw

PATCH 1/1 IB/core: Protect against self-requeue of a cq work item

In reply to Sagi Grimberg
Quoted 7 lines · Sagi Grimberg

We need to make sure that the cq work item does not run when we are destroying the cq. Unlike flush_work, cancel_work_sync protects against self-requeue of the work item (which we can do in ib_cq_poll_work).

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

---

Thanks,
Reviewed-by: Leon Romanovsky <leonro at mellanox.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20170312/b1a2a558/attachment.sig>

#4 lore raw

PATCH 1/1 IB/core: Protect against self-requeue of a cq work item

In reply to Sagi Grimberg
Quoted 6 lines · Sagi Grimberg

We need to make sure that the cq work item does not run when we are destroying the cq. Unlike flush_work, cancel_work_sync protects against self-requeue of the work item (which we can do in ib_cq_poll_work).

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

Hi Sagi, I didn't know if this was a theoretical or you actually hit this in practice, so I pulled it for -rc in case it was actually being hit in the wild. ?Thanks.

Signature · 4 lines
Doug Ledford <dledford at redhat.com>
? ? GPG KeyID: B826A3330E572FDD
? ?
Key fingerprint = AE6B 1BDA 122B 23B4 265B ?1274 B826 A333 0E57 2FDD