From 9966afaf91b37e8c3d106379eeae0afa91c68aa8 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Sat, 3 Jun 2017 09:37:57 +0200
Subject: [PATCH] dm: fix REQ_RAHEAD handling
Git-commit: 9966afaf91b37e8c3d106379eeae0afa91c68aa8
Patch-mainline: v4.13-rc1
References: fate#322738,fate#322919,fate#322950,fate#323773
A few (but not all) dm targets use a special EWOULDBLOCK error code for
failing REQ_RAHEAD requests that fail due to a lack of available resources.
But no one else knows about this magic code, and lower level drivers also
don't generate it when failing read-ahead requests for similar reasons.
So remove this special casing and ignore all additional error handling for
REQ_RAHEAD - if this was a real underlying error we'd get a normal read
once the real read comes in.
Note: rebased for SLE15 by Coly Li.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
drivers/md/dm-raid1.c | 4 ++--
drivers/md/dm-stripe.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1217,7 +1217,7 @@ static int mirror_map(struct dm_target *
*/
if (!r || (r == -EWOULDBLOCK)) {
if (bio->bi_opf & REQ_RAHEAD)
- return -EWOULDBLOCK;
+ return -EIO;
queue_bio(ms, bio, rw);
return DM_MAPIO_SUBMITTED;
@@ -1261,7 +1261,7 @@ static int mirror_end_io(struct dm_targe
if (error == -EOPNOTSUPP)
goto out;
- if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD))
+ if (bio->bi_opf & REQ_RAHEAD)
goto out;
if (unlikely(error)) {
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -384,7 +384,7 @@ static int stripe_end_io(struct dm_targe
if (!error)
return 0; /* I/O complete */
- if ((error == -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD))
+ if (bio->bi_opf & REQ_RAHEAD)
return error;
if (error == -EOPNOTSUPP)