Received: by 10.192.165.156 with SMTP id m28csp1179206imm; Wed, 11 Apr 2018 14:01:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Rc2cO06oMJSa6wWOoubqBekd4vGGGtIqOncHqsE2ko/HtE0w0b/6v4zR2fbr32o46GvQy X-Received: by 2002:a17:902:2e43:: with SMTP id q61-v6mr6584819plb.404.1523480463933; Wed, 11 Apr 2018 14:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523480463; cv=none; d=google.com; s=arc-20160816; b=Tt8CUToKQAbZphI5Qj9ICldqQEc43xN1bVjYDJXaaF86gessHTMvPmU2qBafIwVGG/ OFyrHtJoDWatyWDHOK3DidWUQgBfQd1e0NAscmXKga2qAp2n4rOWm++ZOOhkmE124fYr lI4dSfEfJ/kgnuY4dLPW0Up62SHhuLYEEAEF+L+7Ap2NzhQtE5MpoRg28hwUKEeb1PuT Zktvkclo3VCHSzst9OSOK8/8dVLyS0+V8dkIrQn5a2iYJAMdDmFIpzfKwseASYKIILr1 bqi2BuUJ4NkFzy96zR2EjVoDqpF/AD5ztxgsnsFYagk3mSivpHkMfzZgqWcfjnVtRfFG Fdgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=92pfwNIIjAHjHbSAwPc3QeQG5XQNyxyvv9WjZMfjGjo=; b=ZJgPfdT6Bso9yYT3BvSI+G+9wndF2RMhrZ5xhVx1wWu1zhSYooHutuAmSdDqoXsy5+ RdqbguRnJMwpcmqrWi9MqzZV1+8K/HPo3tNLjbT1sIEr1MBBAtmx5gwGMGArqIA79nfZ Kb8whCnKi1hCa3Rcd5vBPOFf5vFVTPntpr+YKTN6b0uYYg8pgT06C7yLlpQHJok3yiy6 yfgr82k+92yV1ulRH+HlXvX133lSDhjHKqgbZtlNyHH6QBYxXsin8/auqmYkw4TAyQlK 9eQVqAD7ZG8/FYzK6/5dCUNgLLVQDZ/p41j0U24HahZDeG/TNERLDgRPYT3Wul0LEIPP Z7Vg== 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 m12si1233601pgd.240.2018.04.11.14.00.27; Wed, 11 Apr 2018 14:01:03 -0700 (PDT) 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 S1755399AbeDKSoW (ORCPT + 99 others); Wed, 11 Apr 2018 14:44:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58170 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755383AbeDKSoS (ORCPT ); Wed, 11 Apr 2018 14:44:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4B50299F; Wed, 11 Apr 2018 18:44:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Xiong , Jens Axboe , Sasha Levin Subject: [PATCH 4.4 021/190] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op Date: Wed, 11 Apr 2018 20:34:27 +0200 Message-Id: <20180411183551.344306580@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wen Xiong [ Upstream commit f36ea50ca0043e7b1204feaf1d2ba6bd68c08d36 ] When formatting NVMe to 512B/4K + T10 DIf/DIX, dd with split op returns "Input/output error". Looks block layer split the bio after calling bio_integrity_prep(bio). This patch fixes the issue. Below is how we debug this issue: (1)format nvme to 4K block # size with type 2 DIF (2)dd with block size bigger than 1024k. oflag=direct dd: error writing '/dev/nvme0n1': Input/output error We added some debug code in nvme device driver. It showed us the first op and the second op have the same bi and pi address. This is not correct. 1st op: nvme0n1 Op:Wr slba 0x505 length 0x100, PI ctrl=0x1400, dsmgmt=0x0, AT=0x0 & RT=0x505 Guard 0x00b1, AT 0x0000, RT physical 0x00000505 RT virtual 0x00002828 2nd op: nvme0n1 Op:Wr slba 0x605 length 0x1, PI ctrl=0x1400, dsmgmt=0x0, AT=0x0 & RT=0x605 ==> This op fails and subsequent 5 retires.. Guard 0x00b1, AT 0x0000, RT physical 0x00000605 RT virtual 0x00002828 With the fix, It showed us both of the first op and the second op have correct bi and pi address. 1st op: nvme2n1 Op:Wr slba 0x505 length 0x100, PI ctrl=0x1400, dsmgmt=0x0, AT=0x0 & RT=0x505 Guard 0x5ccb, AT 0x0000, RT physical 0x00000505 RT virtual 0x00002828 2nd op: nvme2n1 Op:Wr slba 0x605 length 0x1, PI ctrl=0x1400, dsmgmt=0x0, AT=0x0 & RT=0x605 Guard 0xab4c, AT 0x0000, RT physical 0x00000605 RT virtual 0x00003028 Signed-off-by: Wen Xiong Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/blk-mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1252,13 +1252,13 @@ static blk_qc_t blk_mq_make_request(stru blk_queue_bounce(q, &bio); + blk_queue_split(q, &bio, q->bio_split); + if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { bio_io_error(bio); return BLK_QC_T_NONE; } - blk_queue_split(q, &bio, q->bio_split); - if (!is_flush_fua && !blk_queue_nomerges(q) && blk_attempt_plug_merge(q, bio, &request_count, &same_queue_rq)) return BLK_QC_T_NONE;