From patchwork Tue May 29 03:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10434303 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 1EFE260327 for ; Tue, 29 May 2018 03:29:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A5A4285AB for ; Tue, 29 May 2018 03:29:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1F85285B0; Tue, 29 May 2018 03:29:23 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 690EA285AB for ; Tue, 29 May 2018 03:29:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932963AbeE2D3V (ORCPT ); Mon, 28 May 2018 23:29:21 -0400 Received: from m50210.mail.qiye.163.com ([123.125.50.210]:49382 "EHLO m50210.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932806AbeE2D3T (ORCPT ); Mon, 28 May 2018 23:29:19 -0400 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp6 (Coremail) with SMTP id RNOowEBZp0SQxwxbJuAoAA--.13S3; Tue, 29 May 2018 11:22:56 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, jdillama@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH 2/2] rbd: don't queue lock delayed work when we are removing device Date: Mon, 28 May 2018 23:22:41 -0400 Message-Id: <1527564161-17328-2-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527564161-17328-1-git-send-email-dongsheng.yang@easystack.cn> References: <1527564161-17328-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: RNOowEBZp0SQxwxbJuAoAA--.13S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUJ7CzDUUUU X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbidxpVeln5dNUc+wAAsk Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should not queue a lock delayed work after cancel_delayed_work_sync(&rbd_dev->lock_dwork); So let's don't queue lock delayed work when we are removing device. Signed-off-by: Dongsheng Yang --- drivers/block/rbd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d1d8f46..8d9d0a6 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3032,8 +3032,12 @@ static void rbd_acquire_lock(struct work_struct *work) } } else if (ret < 0) { rbd_warn(rbd_dev, "error requesting lock: %d", ret); - mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, - RBD_RETRY_DELAY); + spin_lock_irq(&rbd_dev->lock); + if (!test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) { + mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, + RBD_RETRY_DELAY); + } + spin_unlock_irq(&rbd_dev->lock); } else { /* * lock owner acked, but resend if we don't see them @@ -3041,8 +3045,12 @@ static void rbd_acquire_lock(struct work_struct *work) */ dout("%s rbd_dev %p requeueing lock_dwork\n", __func__, rbd_dev); - mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, - msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC)); + spin_lock_irq(&rbd_dev->lock); + if (!test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) { + mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, + msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC)); + } + spin_unlock_irq(&rbd_dev->lock); } }