diff mbox

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

Message ID 1489003252-1893-1-git-send-email-sagi@grimberg.me (mailing list archive)
State Accepted
Headers show

Commit Message

Sagi Grimberg March 8, 2017, 8 p.m. UTC
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@grimberg.me>
---
 drivers/infiniband/core/cq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig March 8, 2017, 9:35 p.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche March 8, 2017, 10:12 p.m. UTC | #2
On Wed, 2017-03-08 at 22:00 +0200, Sagi Grimberg wrote:
> 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@sandisk.com>--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky March 12, 2017, 7:29 p.m. UTC | #3
On Wed, Mar 08, 2017 at 10:00:52PM +0200, Sagi Grimberg wrote:
> 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@grimberg.me>
> ---

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Doug Ledford March 24, 2017, 8:41 p.m. UTC | #4
On Wed, 2017-03-08 at 22:00 +0200, Sagi Grimberg wrote:
> 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@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.
diff mbox

Patch

diff --git a/drivers/infiniband/core/cq.c b/drivers/infiniband/core/cq.c
index e95510117a6d..2746d2eb3d52 100644
--- a/drivers/infiniband/core/cq.c
+++ b/drivers/infiniband/core/cq.c
@@ -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);