Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp297920pxb; Wed, 22 Sep 2021 02:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDkYoKcEez9jp4tnqKwwWkZxewM2vWBrOr1R/zkxBeNYCOKYIdi1euivSecqMioCZtAXNr X-Received: by 2002:a05:6e02:1bc4:: with SMTP id x4mr18922262ilv.30.1632302637570; Wed, 22 Sep 2021 02:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632302637; cv=none; d=google.com; s=arc-20160816; b=Li0w0LYstZCY5F3IrgXNrP9XfxlY11yiUlFnRXoUPw2YPsFoSUw7BnMPd/Jk3Uma8A 8a71NkcUq2TOT7UBCODjYIe3xJIe3U5GO/8T3FIaMDoEeqarFBPErM1S7ECHYmPZFcPM C9ug6Yob4TQoacxYZCexji7ERTB3AZsteBuCgJpwxeltRoTirqC5htMVRzjqJixuDeWq x1F7RO03u36Od3+Phw6cYlc85UFQ6C3Gsu4EL8cmTWyKWh0GPCsAPd19Tr7eU87QdRsX 4TwGcuwhGaVwyDUkrPP2vk/YjSwE6Vi26kLdOQDbz/Og43ASg7qr9XGOt3LDMjwxkTbU XspQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F3Q68iPY2i1vTKFIBJAwvjKbsdFYrmn07/rm3Ve2c6E=; b=fGK09PZQszOsngfv5jQxMnd1zNvLhWSaAGirsqoOkyvkCvT260VxU9PCpp5xExE29q 7IndsQZFqUF1yO91sB33usaeEbWX3dQzBpegk7upEFQBHZDmdm75p1Pg7PvIebT6msh6 eWwZ3OcB2exLbD5a5uOMXkhNGFNxiy86NzvHeqrAqDB8bSIzhh243Jqlr5QUynDHe+aN k48ZHHHxw+dXR2o/tchoTbi3y1NLie8OP8PVYagWBaaaSISY06sD2rSPrw7c8Ed+PfTF 6IOi66lwDyz8IAClVqDR0dRRtRDJAKkpE9FQ/28G8Oq/UhPpsw7P0bFwiItr/j8FowHr u4HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LDV35lMt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k39si1814237jav.88.2021.09.22.02.23.45; Wed, 22 Sep 2021 02:23:57 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LDV35lMt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234283AbhIVJXp (ORCPT + 99 others); Wed, 22 Sep 2021 05:23:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55872 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234281AbhIVJXo (ORCPT ); Wed, 22 Sep 2021 05:23:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632302534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=F3Q68iPY2i1vTKFIBJAwvjKbsdFYrmn07/rm3Ve2c6E=; b=LDV35lMtZfDZpsUuKk41QOHqjkmam4W7YfKPl1xRMS4+Sl/rx0BQo71wkD2MwBmuiR0W4R oGk642Gt8D6ya6kLs8c2u4v1LitO+NTnaE5kOdJ89LQf8H2lRhnOv/KAzjhzeSxA5l3Tck iBzMdymuva3knTTGPCPbxVrXVMoQsio= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-j1dwDayBO225cQshvljKnw-1; Wed, 22 Sep 2021 05:22:09 -0400 X-MC-Unique: j1dwDayBO225cQshvljKnw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07D1B1006B10; Wed, 22 Sep 2021 09:22:08 +0000 (UTC) Received: from T590 (ovpn-8-35.pek2.redhat.com [10.72.8.35]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C39D385; Wed, 22 Sep 2021 09:21:56 +0000 (UTC) Date: Wed, 22 Sep 2021 17:22:07 +0800 From: Ming Lei To: "yukuai (C)" Cc: josef@toxicpanda.com, axboe@kernel.dk, hch@infradead.org, linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com Subject: Re: [patch v8 3/7] nbd: check sock index in nbd_read_stat() Message-ID: References: <20210916093350.1410403-1-yukuai3@huawei.com> <20210916093350.1410403-4-yukuai3@huawei.com> <7e2913ca-1089-9ab7-cfdb-5e8837d36034@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e2913ca-1089-9ab7-cfdb-5e8837d36034@huawei.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 19, 2021 at 06:34:28PM +0800, yukuai (C) wrote: > 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? I think this one relies on nbd protocol between server and client, and does the protocol require both request and reply xmitted via same socket? Thanks, Ming