From patchwork Wed Mar 8 20:00:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9611889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A8A160524 for ; Wed, 8 Mar 2017 20:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DDEF28608 for ; Wed, 8 Mar 2017 20:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02C662862C; Wed, 8 Mar 2017 20:31:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 649232862D for ; Wed, 8 Mar 2017 20:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754563AbdCHUbf (ORCPT ); Wed, 8 Mar 2017 15:31:35 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:34662 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754472AbdCHUbe (ORCPT ); Wed, 8 Mar 2017 15:31:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o7eZNhnTuLx7eE5thFuMcJ3nVIkR1qVNe1BFzr+YXeU=; b=InWLUnttSfHLzyzNTIFGJ/AEU F1H7s2i0Zg/zE0YO4gg3NlpF90IkKdXGYwCd1XN5cStzKYAVjo1+tazuBissGpaebi746VmxoYQus 6WQLf0WttBnQp8zXbV62Y4lzAKkQtfS278+wUqVc8TbBHSleIuwbwHo8st6G+lfr/f9xt68hMdQyg Fmt+cxJIZx9o450aVEp56neE6UjEL9+JWh564K7FktSL+BIw3BODYPfixOz8jetqogovX24G0pxkO pZkvvQW+Ph2FZPYsXSK6fPUSjxNLqpawbsCvRgHAykztl6o4ID2V2q6f055sUFH8EvSo8+YMgmWrH pETVq61dA==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1clhlZ-0006h2-F9; Wed, 08 Mar 2017 20:00:58 +0000 From: Sagi Grimberg To: linux-rdma@vger.kernel.org Cc: Christoph Hellwig , linux-nvme@lists.infradead.org Subject: [PATCH] IB/core: Protect against self-requeue of a cq work item Date: Wed, 8 Mar 2017 22:00:52 +0200 Message-Id: <1489003252-1893-1-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche -- Reviewed-by: Leon Romanovsky --- drivers/infiniband/core/cq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);