Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2000538imu; Thu, 24 Jan 2019 05:43:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hrjodkQwPcpHoaESMxjuG61Szjr4kqAdiKsveMZR2d6sQY3Q5KKfJDIwecprhYfNlLtiK X-Received: by 2002:a63:40c6:: with SMTP id n189mr5860951pga.355.1548337432518; Thu, 24 Jan 2019 05:43:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548337432; cv=none; d=google.com; s=arc-20160816; b=PIG8S0EK8GAUPsV4L3e6kIGkXoXtgfQFaPVnLIvBqINaqpiKcMvag5QtsGK4Vn7waS oHXh228bODdz8XnVJq2AYBmBJBWKkFoBC3BJjA5DZIBP1ozArGmPoNqL0J5BtiR8STui YjsgcoIVTxJ2RHc1s0JHMhG2uRY3azEfbh84C+fXfaANclht5kr/6qpyV+7zc0b2LIUx EC5gTQI5bd8tnDmkzCp8lFeoSl2MooEm0tN6IZWu8wi+tN6v4VItwMRL+rK1TZPNXvuf cerElPAX1lsRaHgTj8KeXZ3wccOfmDy3zv4ODdPFAa280Oj9cdruOxsiL8Hx/QvxU7s/ r4fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=OSY/hZI0KUwkUUHRp5ktrSRsgVGwCANzta147eViMRE=; b=h9O4GGJbTUixtEqW4hE59oIH9Wzu+eD3cWnQZ9wT2dgFL5KpdozXDhuKKOxqNhOWJq doxGf1zr+AHa2x3f3cgqxhOTTwlvy2ohwkoyxNHBGyd1ffVpVxstLl4LxssPLB/WBAZ8 r6y31QJw6ynEJSzcCYsLJNiXoCI1LBzWUJet4TRYSsT6/JCWot0+JFNiE2FUe7k6eYPU 0PDXX1odsJg8Cj6N7oguqsqUz/B12oeKExNFRDiOZpnukE5lRwpDPLTczKUvOKTGQGIm +sBocV2+O9TdnDdtGRO7qFGHAq2bUE85kXCAWtWVgH00c01Q0aNGq8zIrKy8t8dD1Atz hKVg== 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 v32si20484151plb.369.2019.01.24.05.43.36; Thu, 24 Jan 2019 05:43:52 -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 S1727942AbfAXNnO (ORCPT + 99 others); Thu, 24 Jan 2019 08:43:14 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2228 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726105AbfAXNnO (ORCPT ); Thu, 24 Jan 2019 08:43:14 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C39814B312EBD136C31C; Thu, 24 Jan 2019 21:43:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Thu, 24 Jan 2019 21:43:00 +0800 From: chenxiang To: , CC: , , , , chenxiang Subject: [PATCH] block: set rq->cmd_flags with bio->opf instead of data->cmd_flags when bio is not Null Date: Thu, 24 Jan 2019 21:43:50 +0800 Message-ID: <1548337430-66690-1-git-send-email-chenxiang66@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.8.1