Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1094354pxb; Sun, 19 Sep 2021 06:03:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEzWRLqMBbfes1tUWooA1i1fkUSxJrmkPJsoAhGhHqeppE/F6gpTWdhUU6xnThB8vSsBqU X-Received: by 2002:a05:6e02:1a6b:: with SMTP id w11mr14497351ilv.21.1632056614344; Sun, 19 Sep 2021 06:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632056614; cv=none; d=google.com; s=arc-20160816; b=gOOiOlHwulppUSCP8+ClSR0dLfVg4TtbsdwpaZSoocWgzpV8JKnHv2LFIXdTTL7iDR fgdKW8TAdGdaCzOtxgJasztIPUVX/py5So9Cn5ngXg4N44ojq0G2wu3/j586gngAadF+ etRwamOag4aQ+0xmumKcjDdyLjtX/DK+s/CuzCtsQhZotXVRAYPZyeXAapivYoPF4bqC suTOthhVvEL4gtI1DFzSTy2uJHybC/4bWJFfO3Z2ZEAahxyVpmQajrVzslRVxBn7p8Ev WWj/LQBg/CnnL+DCt3JgxvvxpHGWr83Pjf18zbD2xv6FszEHfJv7ZauhAjoCeHgiax/Y rhjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=g6vAYd5w3BGQp3Y4JtC3JVMKkT2WRyC74pjUgmHSPiI=; b=avIgDMGidtbccxHuokQBCR5e+m+lMzRytM1HpObCfXKzejcotrQVznR4TQag5k3dtz Uxwq//Ke3lGBm0VLOX0srSB9d4DAoiEGwh33t56oU89ghaObNpimi4U17Kvm1e2Es7uJ 4iX9Jt/cQZfTGChl3LcKhM0JnP2mTusDPIFW9ZTBy/WKdXlTm/ri3l9Pv5blFTxjuGva 1kqFHFRlQFaQ0pd3XOwLbSvJf+vPLCBPIzqYnZAZOkk8DYfSI5rgMav8Enjp8ADKr8JM QEO2bX1LK9GRUYhu4bud4O/jPKyQst/QdkJN1Chn4sztBcb8qe4Q4qRqaCOH72QLZnxm 6Q6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s17si4909607ios.107.2021.09.19.06.03.20; Sun, 19 Sep 2021 06:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbhISKf5 (ORCPT + 99 others); Sun, 19 Sep 2021 06:35:57 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:19993 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhISKf4 (ORCPT ); Sun, 19 Sep 2021 06:35:56 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HC3qJ1zD7zbm1c; Sun, 19 Sep 2021 18:30:20 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Sun, 19 Sep 2021 18:34:29 +0800 Received: from [10.174.176.73] (10.174.176.73) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Sun, 19 Sep 2021 18:34:29 +0800 Subject: Re: [patch v8 3/7] nbd: check sock index in nbd_read_stat() To: , , , CC: , , , References: <20210916093350.1410403-1-yukuai3@huawei.com> <20210916093350.1410403-4-yukuai3@huawei.com> From: "yukuai (C)" Message-ID: <7e2913ca-1089-9ab7-cfdb-5e8837d36034@huawei.com> Date: Sun, 19 Sep 2021 18:34:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20210916093350.1410403-4-yukuai3@huawei.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/09/16 17:33, Yu Kuai wrote: > The sock that clent send request in nbd_send_cmd() and receive reply > in nbd_read_stat() should be the same. > > Signed-off-by: Yu Kuai > --- > drivers/block/nbd.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c > index 614c6ab2b8fe..c724a5bd7fa4 100644 > --- a/drivers/block/nbd.c > +++ b/drivers/block/nbd.c > @@ -746,6 +746,10 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) > ret = -ENOENT; > goto out; > } > + if (cmd->index != index) { > + dev_err(disk_to_dev(nbd->disk), "Unexpected reply %d from different sock %d (expected %d)", > + tag, index, cmd->index); > + } > if (cmd->cmd_cookie != nbd_handle_to_cookie(handle)) { > dev_err(disk_to_dev(nbd->disk), "Double reply on req %p, cmd_cookie %u, handle cookie %u\n", > req, cmd->cmd_cookie, nbd_handle_to_cookie(handle)); > Hi, Ming Any suggestions about this patch? Thanks, Kuai