Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp522934ybl; Mon, 12 Aug 2019 21:30:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO68dcXwhQ3Tk+dL177dBwR96sNb9AUt7DYuQFDLai1yFMVeb8OyuOYoHNx+gUWPNeMvlY X-Received: by 2002:a17:90a:2846:: with SMTP id p6mr414760pjf.101.1565670634166; Mon, 12 Aug 2019 21:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565670634; cv=none; d=google.com; s=arc-20160816; b=lAaw0GmLRjII0PZox0fwkEI8xVTrZDqsXyYmtNyLgl4cbwtY1OG4pPsmQ6cG+Qc5Xa SHEn4xlkNFI7wPXHGq3w5BGzXrKTn8KhTt9d/YzHgrpc6YCAEk1ysbDbRjGxtGYU47CQ 7HNi4Lv03vjUPYlF571EGHlelJtMm1b2slNAYlTu7rfnum4DaLahRdw3mMLVzc198/Xl yLw3RMBbrBbm8Qd/FcXd/3yjJcWri96ie9dNByJ6IJ1V2Dad+paC4NnwRc3M4+L2Arhi tYBKVvt0a0odESWu7Idxsm/GSmN9SGGc7k7PlOtNQ+9ulzb0FjeKrkY6i2WYH4SjBPFG e36A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject; bh=EJJopm5lah5F1iMdNqrkbyQtxiV9VdPpRbhgfVZqyqw=; b=l4t4aDgPL63tykLEvux1i9F7YSlsMcvXNYibt8Kc7jV3sil9QGuE1G2b98OSTteH7A HkcWB5U4GWycW/U0ALdbLpJUM7/3+wzOzE+06wGTFa5bUAFXB72FoBWLWgPnho/OrlJz +iCbmd3xlI5zaUIgmK7FwvqvQpByigTmaRc7pGvUOs2X+cxqz+agot+CeU75JwHe1wqK JfZNsNAu4433tgGNq3KIYsVXBDS9kG1S61FV1rZDvRbD3bAqzm491PlqnRXuQjqupr+c jx2nQ0eBG1xRbExgwsCuCptyCo/xkqpf2te9CFy02o5llimA5jp29yrOTDGf3xyUrZdW nGPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65si61568275pgd.487.2019.08.12.21.30.18; Mon, 12 Aug 2019 21:30:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbfHME2c (ORCPT + 99 others); Tue, 13 Aug 2019 00:28:32 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:49568 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725815AbfHME2c (ORCPT ); Tue, 13 Aug 2019 00:28:32 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 089BAF5CF0F1E40671D2; Tue, 13 Aug 2019 12:28:29 +0800 (CST) Received: from [127.0.0.1] (10.184.194.169) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Tue, 13 Aug 2019 12:28:23 +0800 Subject: Re: [PATCH] nbd: add a missed nbd_config_put() in nbd_xmit_timeout() To: Mike Christie , , , , , References: <1565613086-13776-1-git-send-email-sunke32@huawei.com> <5D518714.5000408@redhat.com> From: "sunke (E)" Message-ID: Date: Tue, 13 Aug 2019 12:28:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <5D518714.5000408@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.184.194.169] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for your review. 在 2019/8/12 23:34, Mike Christie 写道: > On 08/12/2019 07:31 AM, Sun Ke wrote: >> When try to get the lock failed, before return, execute the >> nbd_config_put() to decrease the nbd->config_refs. >> >> If the nbd->config_refs is added but not decreased. Then will not >> execute nbd_clear_sock() in nbd_config_put(). bd->task_setup will >> not be cleared away. Finally, print"Device being setup by another >> task" in nbd_add_sock() and nbd device can not be reused. >> >> Fixes: 8f3ea35929a0 ("nbd: handle unexpected replies better") >> Signed-off-by: Sun Ke >> --- >> drivers/block/nbd.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c >> index e21d2de..a69a90a 100644 >> --- a/drivers/block/nbd.c >> +++ b/drivers/block/nbd.c >> @@ -357,8 +357,10 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req, >> } >> config = nbd->config; >> >> - if (!mutex_trylock(&cmd->lock)) >> + if (!mutex_trylock(&cmd->lock)) { >> + nbd_config_put(nbd); >> return BLK_EH_RESET_TIMER; >> + } >> >> if (config->num_connections > 1) { >> dev_err_ratelimited(nbd_to_dev(nbd), >> > > I just sent the same patch > > https://www.spinics.net/lists/linux-block/msg43718.html > > here > > https://www.spinics.net/lists/linux-block/msg43715.html > > so it looks good to me. > > Reviewed-by: Mike Christie > > . >