Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1498606ybl; Wed, 14 Aug 2019 18:32:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/u/KkH6W5YNrs1l+GZCAl6aLIsnb/G9yqzHettCn2RxaJp1rw5lRMX8pf+uIc9d2NVaW6 X-Received: by 2002:aa7:8d98:: with SMTP id i24mr2950608pfr.199.1565832766880; Wed, 14 Aug 2019 18:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565832766; cv=none; d=google.com; s=arc-20160816; b=F0PnfE4NWyBY4kyP8TsqcdcHNfrPaX0sxo/6MCbC+yuGGf9IQEdjCPjez5SDl9YxtM a4hZ/j6o8tHfX53o+nYot9VcIzq2DIgESrHl+QEmTB0SqVaHkcdVy9ICt+GRJZaLzPWA lDL1/f3KhxAam8ztxLS2Ow9BdngsVnitTvON5lq5zNu/+Or0HjHQm1CTZu3uZdqAuwDT 8E/BQZ+fd8LrMcJAHA84u2VM/kdpBQC/neDMzyxrROXgE854TI2+wl2CVdM5uViqFh7n UtE18vy+Il3KS6uN+ZU7TfUHMUAPUeWU54eoKvcAoZ4lF654A/dIdJqgsOtChaq/YZeQ pWTA== 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=tEBbsCjWdvboi8AykZCYvmK99XO2XR+AMA8ambdOrw4=; b=OQxT6BaRe2qSLxAyFW12F1DAokPLROYUtq5WHt0cNHc+50DdcxCk25lsHfEAa++ZP7 J7jwxHQKkHUXIbNQO+/G1Ji1LyjZLFbpza1q6i0JRt+AuknozB+q0bQ1nOU3HKmUY3jM Zs6rh3y+m1W0SB+CAlzmJQvMKcVzoem6m5YM32BRfui0qmsi0Gv9wGQlA/oWN8HIc5qy /GhUY5Jp6HTzjyYIkEiv+mO2POFrvdSL3OCdv4k7BqHYWynRkIKd1S8dr3PupU8rP0mv hLaOE9bMovKhUoo1R4w8cTS2oAgqRTRsnAnJftDj/OKQhdjx0hudHJsXggoA03lDE7EL 5MTA== 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 y6si853722pgp.320.2019.08.14.18.32.30; Wed, 14 Aug 2019 18:32:46 -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 S1728898AbfHOB1U (ORCPT + 99 others); Wed, 14 Aug 2019 21:27:20 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:57076 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727822AbfHOB1U (ORCPT ); Wed, 14 Aug 2019 21:27:20 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8239D636284E109C16C6; Thu, 15 Aug 2019 09:27:18 +0800 (CST) Received: from [127.0.0.1] (10.184.194.169) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Thu, 15 Aug 2019 09:27:14 +0800 Subject: Re: [PATCH] nbd: add a missed nbd_config_put() in nbd_xmit_timeout() To: , , , , References: <1565613086-13776-1-git-send-email-sunke32@huawei.com> From: "sunke (E)" Message-ID: <05b3cd4a-d2c1-5ad7-7a39-64bac470032a@huawei.com> Date: Thu, 15 Aug 2019 09:27:13 +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: <1565613086-13776-1-git-send-email-sunke32@huawei.com> Content-Type: text/plain; charset="gbk"; 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 ping ?? 2019/8/12 20:31, Sun Ke ะด??: > 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), >