Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2634941imu; Thu, 24 Jan 2019 16:58:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN6wH6HZ3l6Z7NopQbf6isKA83w5Du5BeQa1wlb5Q7zXWwhnmRnmeCN5rlESh3AbN6GGcbez X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr8947338plb.332.1548377907270; Thu, 24 Jan 2019 16:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548377907; cv=none; d=google.com; s=arc-20160816; b=MF1hEt894tMBwuTUTmBjU4hsI41K6vAOBb/Ldsf2kcljUC7tpLME7SdyTD6sy1S4DP 1s0R9EMyBvC/AKu0joDZNWDk1OPbO4rtSTRwEGdzkylZSv6C5dUlgTlJ8/g4Un6wPrYK st7nJojT5/sztUyMgJCbON8CH6RlHumPalnycoKxJXg9wvnvfpZNB/uXxJhmJeoO3clM xupA4jSQkIj/T3d8v39SpFl0CXxFe3Bulh51w+PKj0l7izMWY9zJ9jSVYGoCUGswyYvS 7objKkckTGnQxZedhPI7n5qbVYBOLLxFLVclxX/3mp2UNtb6H9WiC0DmxEiNjto9WHAd OT+w== 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:cc:references:to :subject; bh=vkfMh2ny1GyWuGxJSpstzhfRGuDfLmyMS3cizRAcPdE=; b=vK9J95QFvlgAP4AYWqrZIoPERQowapYLx3LXumkfxv9fhbf6P3zG6bOR6r/MGvXz/8 pIR97xJr6ARuK9lIYJ+52PYAa2lIWd/9bK3aslECwEdL2bFg8XhTTWqWXlOej3ZRRBkf Vre6bnJFOZr5f5GEtmuH7GKmAZUmkiGv9O5rlMvBwSS3d68u2FIVZAeizMCmCC5aQrCP xustgKCXRcXd0wcNHtnrxJFddSL1iVbTsIAadHLNyZ1Aj5uFFWbqhWKJH+YAYCIZy/vf 9UeX+7QZyjRcpylsjJQlHcQmzB1YyYvWlbXTnKyhqHyMC8uz6e4KSmr1SCABHT69/Ksf rruw== 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 u91si25046162plb.237.2019.01.24.16.58.12; Thu, 24 Jan 2019 16:58:27 -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 S1728372AbfAYA5e (ORCPT + 99 others); Thu, 24 Jan 2019 19:57:34 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:44976 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726015AbfAYA5e (ORCPT ); Thu, 24 Jan 2019 19:57:34 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C7E8C7E76369B5562B92; Fri, 25 Jan 2019 08:57:31 +0800 (CST) Received: from [127.0.0.1] (10.74.219.194) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 25 Jan 2019 08:57:24 +0800 Subject: Re: [PATCH] block: set rq->cmd_flags with bio->opf instead of data->cmd_flags when bio is not Null To: , References: <1548337430-66690-1-git-send-email-chenxiang66@hisilicon.com> CC: , , , , , "linux-block@vger.kernel.org" From: "chenxiang (M)" Message-ID: <1c34d6f9-8c3c-a7ff-a956-46e9dc3c2298@hisilicon.com> Date: Fri, 25 Jan 2019 08:57:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1548337430-66690-1-git-send-email-chenxiang66@hisilicon.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.219.194] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +cc Jens + linux-block ?? 2019/1/24 21:43, chenxiang ะด??: > In function blk_mq_make_request(), though data->cmd_flags will be > initialized with bio->opf, later bio->opf may be set as REQ_INTEGRITY > if enabled DIX. So need to use bio->opf instead of data->cmd_flags in > function blk_mq_rq_ctx_init(), or flags REQ_INTEGRITY will not be set > 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. > > Fixes: f9afca4d367b ("blk-mq: pass in request/bio flags to queue mapping") > > Signed-off-by: Xiang Chen > Reviewed-by: John Garry > --- > block/blk-mq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 3ba37b9..c4a1c63 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -394,7 +394,7 @@ static struct request *blk_mq_get_request(struct request_queue *q, > return NULL; > } > > - rq = blk_mq_rq_ctx_init(data, tag, data->cmd_flags); > + rq = blk_mq_rq_ctx_init(data, tag, bio ? bio->bi_opf : data->cmd_flags); > if (!op_is_flush(data->cmd_flags)) { > rq->elv.icq = NULL; > if (e && e->type->ops.prepare_request) {