All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request
@ 2016-02-05  7:10 jiangyiwen
  0 siblings, 0 replies; only message in thread
From: jiangyiwen @ 2016-02-05  7:10 UTC (permalink / raw)
  To: linux-scsi, linux-block; +Cc: Martin K. Petersen, Lukáš Czerner

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.

Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 block/blk-lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index 9ebf653..e4f02f1 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -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);
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-05  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05  7:10 [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request jiangyiwen

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.