Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1575424ybl; Wed, 14 Aug 2019 20:17:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxepLPKsfQwa5cT16n+LbsFPipk4JF+yuHICoYLHhmq2nzF2NFnWwZ4+P8ILioGFwnFHlSS X-Received: by 2002:a65:64cf:: with SMTP id t15mr1911701pgv.88.1565839032477; Wed, 14 Aug 2019 20:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565839032; cv=none; d=google.com; s=arc-20160816; b=BDdusIICjUhC+CJAGfjsVLXHz2fZIfC9ucfI7YeFYwvR8ARJdoN05JGkjVekEgiGDf VNFV2IoNzfGhmPQY0zCbxrgdPA2ortWu45AHwYlYQzxCQT2ikKnsG3hrOPLKbQd7TuM6 4bHJpPFcdx2fdTs+gzs0YUzeDrsu4fQOskYkomZgKDlwL1dRfG7AUuSutF9jzYRTFfcR rJ3PQsV1fy9LCPGoGTxmYVJ4CTFq1d5jn8DxkYqfDAf569XojsLhHFAsUIGD3+nicrdB I1w9jGps+ev4QMflPrMFN86m0UE4BZAeMhlFIZ95PS2NS3K+BfKyuJFGn5aB1Xz8Gz6k jqxw== 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=UCDK2DLcOzdNU797diskgE8M3nXUjDCuX13WeRXq2wg=; b=QGjWMdjs1SPP8VMA77v9boAhsSNwMJXQw+hvmFkU8hRUmBBrvvbZrA3nYUJVWNrVFv qN37611waC6ef0ZnCxW2XTR/4Q+eU4OxNxbCTp9362ho7Wh8b5FcW9gRh3X+xy7COuMd Q3gz901g99a8Qtv8dDmEFshSERczOOiCJlrmqYg2ynEz6IFCSGwKexcNWLGxcVE9mkSY WEb6NJWLn+KzINY4+pgfXC8GNJmIKHj/tSk1rFRxEEymwOBaJGuszuoMq2YT4lJML/YQ f0m+WKiVsKO7TIUwY95vDjdRx4ZdpdufM96B35zNBUgkrSX2qeqWgb9RkzOLwfUO+Ebw TzeQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si1095195pfh.6.2019.08.14.20.16.44; Wed, 14 Aug 2019 20:17:12 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729176AbfHODNW (ORCPT + 99 others); Wed, 14 Aug 2019 23:13:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42160 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbfHODNW (ORCPT ); Wed, 14 Aug 2019 23:13:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05BC74628B; Thu, 15 Aug 2019 03:13:22 +0000 (UTC) Received: from [10.10.120.60] (ovpn-120-60.rdu2.redhat.com [10.10.120.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E90D1001B02; Thu, 15 Aug 2019 03:13:21 +0000 (UTC) Subject: Re: [PATCH] nbd: add a missed nbd_config_put() in nbd_xmit_timeout() To: "sunke (E)" , josef@toxicpanda.com, axboe@kernel.dk, linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org References: <1565613086-13776-1-git-send-email-sunke32@huawei.com> <05b3cd4a-d2c1-5ad7-7a39-64bac470032a@huawei.com> From: Mike Christie Message-ID: <5D54CDD0.1010701@redhat.com> Date: Wed, 14 Aug 2019 22:13:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <05b3cd4a-d2c1-5ad7-7a39-64bac470032a@huawei.com> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 15 Aug 2019 03:13:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Josef had ackd my patch for the same thing here: https://www.spinics.net/lists/linux-block/msg43800.html so maybe Jens will pick that up with the rest of the set Josef had acked: https://www.spinics.net/lists/linux-block/msg43809.html to make it easier. On 08/14/2019 08:27 PM, sunke (E) wrote: > 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), >> >