All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op
@ 2017-05-10 13:54 wenxiong
  2017-05-10 14:02 ` Jens Axboe
  2017-05-10 14:39 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: wenxiong @ 2017-05-10 13:54 UTC (permalink / raw)
  To: linux-block; +Cc: brking, dougmill, axboe, wenxiong

From: Wen Xiong <wenxiong@linux.vnet.ibm.com>

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 <wenxiong@linux.vnet.ibm.com>
---
 block/blk-mq.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index c7836a1..4754a4a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1517,13 +1517,13 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
 
 	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;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op
  2017-05-10 13:54 [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op wenxiong
@ 2017-05-10 14:02 ` Jens Axboe
  2017-05-10 14:39 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-05-10 14:02 UTC (permalink / raw)
  To: wenxiong, linux-block; +Cc: brking, dougmill

On 05/10/2017 07:54 AM, wenxiong@linux.vnet.ibm.com wrote:
> From: Wen Xiong <wenxiong@linux.vnet.ibm.com>
> 
> 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

Good catch, your fix looks correct to me.


-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op
  2017-05-10 13:54 [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op wenxiong
  2017-05-10 14:02 ` Jens Axboe
@ 2017-05-10 14:39 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2017-05-10 14:39 UTC (permalink / raw)
  To: wenxiong; +Cc: linux-block, brking, dougmill, axboe


wenxiong@linux.vnet.ibm.com,

> 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.

Looks good.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-10 14:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 13:54 [PATCH] blk-mq: NVMe 512B/4K+T10 DIF/DIX format returns I/O error on dd with split op wenxiong
2017-05-10 14:02 ` Jens Axboe
2017-05-10 14:39 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.