Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3599796imu; Mon, 28 Jan 2019 07:38:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN5JrkJaGckuvS7SEyUXQDLM4TKH00udLrFVA71+vrdRnYwqvEE19smShvYaJtVhrvh12dBm X-Received: by 2002:a62:1e45:: with SMTP id e66mr22157307pfe.152.1548689892359; Mon, 28 Jan 2019 07:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548689892; cv=none; d=google.com; s=arc-20160816; b=rdGH+jH/hLkIgoVohVDq2ezrbKQkYm7vvTkbNufgVjaI/TB4ZjxzGSAD8XjNRvDhgQ UgW1NDI0xsKVUJrmvhjHLxJbcBuqVrTXw+wFxo6ehYqhehmka2IJZg3HlR0dgjikcqAV XpIpet9qF5mNp9Ra05fdk9OTCSSx+pwCRr351HrAUWLArCeXxO78V3/qF14w3WUk9Zkl Q3zhqDzWAsWDTZSg8gzfR7GBfUbM2Ou+JFOVaMT2CDKs570ezB6RGGSz/A4vwkyYl+JR JKlKyoUo6Z0l0HrH+1BuIu/PP+bS2+3LAhZVjfES6JRODxqau9YuUEMhPpNK09UlamCf tjHg== 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:cc:references:to:subject :from; bh=FuTaWA9ix+GlMK/Ms54Fz6ZEiBXiSTl7clpA16x9sJg=; b=O7MxXiBZuG2wo7WF4qku39fiPIvCpNb/4ZgZVWKfKp8mOcIJNmRhdyu1nB6L7xDLYI HCXynlX55Rsipw3QoSo8n5uKRs+hcSuevMv3Ip1lJK5CIke6DpgnvmCSpcSydRLlooKS V1ygnClq/WrE9zx3G93qn+s3PFvdsjKUGXGUWkgGilJkm/oe1pL4F+FyokqBthmgLRF4 N02mavi2JwqTA38vJ9/AYcnwFouHF3d1qElREiJoiqCG2ttlEX8EuQO7O8tymIzXtJg6 vzRG6UKlrxujFi6A+6ev16bBZfUuYwIJZKxLxodm1FkDfQPzY9KWmxvisMeioB101a6D uTaA== 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 z5si443595pgu.19.2019.01.28.07.37.57; Mon, 28 Jan 2019 07:38:12 -0800 (PST) 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 S1726829AbfA1PhU (ORCPT + 99 others); Mon, 28 Jan 2019 10:37:20 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:48822 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726693AbfA1PhU (ORCPT ); Mon, 28 Jan 2019 10:37:20 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 32BD1F30C2BA0B8F7769; Mon, 28 Jan 2019 23:37:11 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Mon, 28 Jan 2019 23:37:04 +0800 From: John Garry Subject: Re: [PATCH] block: set rq->cmd_flags with bio->opf instead of data->cmd_flags when bio is not Null To: Christoph Hellwig , "chenxiang (M)" References: <1548337430-66690-1-git-send-email-chenxiang66@hisilicon.com> <1c34d6f9-8c3c-a7ff-a956-46e9dc3c2298@hisilicon.com> <20190128140716.GA18162@infradead.org> CC: , , , , , , "linux-block@vger.kernel.org" Message-ID: <55972c1a-051a-1396-6796-84f349830a35@huawei.com> Date: Mon, 28 Jan 2019 15:36:58 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190128140716.GA18162@infradead.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/01/2019 14:07, Christoph Hellwig wrote: >>> for rq->cmd_flags. It will cause dix=0 in function >>> sd_setup_read_write_cmnd() when enabled DIX, which will cause IO >>> exception when enabled DIX. >>> >>> For some IOs such as internal IO from SCSI layer, the parameter bio of >>> function blk_mq_get_request() is Null, so need to check bio to >>> decise rq->cmd_flags. > > We have data->cmd_flags to deal with the NULL bio case. > blk_mq_make_request initializes data->cmd_flags from bio->bi_opf > just before calling blk_mq_get_request, so I'm really missing what you > are trying to fix here. As I understood, the problem is the scenario of calling blk_mq_make_request()->bio_integrity_prep() where we then allocate a bio integrity payload in calling bio_integrity_alloc(). In this case, bio_integrity_alloc() sets bio->bi_opf |= REQ_INTEGRITY, which is no longer consistent with data.cmd_flags. John > > . >