block: do not return -EOPNOTSUPP only when issue a discard request
Subsystems (2)
PATCH 1/1 block: do not return -EOPNOTSUPP only when issue a discard request
commit 8af1954d172a("blkdev: Do not return -EOPNOTSUPP if discard is supported") only solve the situation of discard, because When applications issue a discard request to device, they can't expect deterministic behaviour. However, WRITE SAME should not ignore error with EOPNOTSUPP, because if applications issue WRITE SAME requests to device, it should return deterministic results to applications according to the T10 standard, or else it will cause an inconsistent state between upper layer and bottom layer.
So ignoring error with EOPNOTSUPP only in discard situation.
--- block/blk-lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/blk-lib.c +3 -1
@@ -19,7 +19,9 @@ static void bio_batch_end_io(struct bio *bio) {struct bio_batch *bb = bio->bi_private; -if (bio->bi_error && bio->bi_error != -EOPNOTSUPP ) +/* ignore -EOPNOTSUPP only when issue a discard request */ +if (bio->bi_error && (!(bio->bi_rw &REQ_DISCARD ) || + (bio->bi_error != -EOPNOTSUPP ))) bb->error = bio->bi_error;if (atomic_dec_and_test (&bb->done))complete (bb->wait);
Signature · 1 line
1.8.4.3
Quoted 18 lines · jiangyiwen
Date: Wed, 3 Feb 2016 17:54:36 +0800
From: jiangyiwen <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected],
Lukáš Czerner <[email protected]>, [email protected], "Qijiang (Joseph, Euler)" <[email protected]>
Subject: [dm-devel] [PATCH] block: do not return-EOPNOTSUPPonly when issue a
discard requestcommit 8af1954d172a("blkdev: Do not return
-EOPNOTSUPPif discard is supported") only solve the situation of discard, because When applications issue a discard request to device, they can't expect deterministic behaviour. However, WRITE SAME should not ignore error with EOPNOTSUPP, because if applications issue WRITE SAME requests to device, it should return deterministic results to applications according to the T10 standard, or else it will cause an inconsistent state between upper layer and bottom layer.
Quoted 3 lines
So ignoring error with EOPNOTSUPP only in discard situation.
Signed-off-by Yiwen Jiang <[email protected]>
Looks good.
Thanks!
-Lukas
Quoted 20 lines
--- block/blk-lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)block/blk-lib.c +3
-1@@ -19,7 +19,9 @@ static void bio_batch_end_io(struct bio *bio) {struct bio_batch *bb = bio->bi_private; -if (bio->bi_error && bio->bi_error != -EOPNOTSUPP ) +/* ignore -EOPNOTSUPP only when issue a discard request */ +if (bio->bi_error && (!(bio->bi_rw &REQ_DISCARD ) || + (bio->bi_error != -EOPNOTSUPP ))) bb->error = bio->bi_error;if (atomic_dec_and_test (&bb->done))complete (bb->wait);
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yiwen" == jiangyiwen <[email protected]> writes:
Yiwen> commit 8af1954d172a("blkdev: Do not return -EOPNOTSUPP if discard Yiwen> is supported") only solve the situation of discard, because When Yiwen> applications issue a discard request to device, they can't expect Yiwen> deterministic behaviour. However, WRITE SAME should not ignore Yiwen> error with EOPNOTSUPP, because if applications issue WRITE SAME Yiwen> requests to device, it should return deterministic results to Yiwen> applications according to the T10 standard, or else it will cause Yiwen> an inconsistent state between upper layer and bottom layer.
Yiwen> So ignoring error with EOPNOTSUPP only in discard situation.
If an underlying device fails a WRITE SAME request, SCSI will not return EOPNOTSUPP. Instead we will mark 0 bytes of the request as complete and disable WRITE SAME support on the device. So any EOPNOTSUPP error in this case would be coming from MD/DM.
That said, I agree with the patch.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering