Skip to contentSkip to conversation

dm: check error instead of r in clone_endio

PATCH In review alex chen 2 participants 3 messages Dec 17, 2014 – Dec 18, 2014 Device mapper

lore
Share & tools
lore

alex chen

author
#0 lore raw

PATCH 1/1 dm: check error instead of r in clone_endio

In the clone_endio, when target_type is linear and WRITE SAME bio fails, r will be always be initialized 0 because of null end_io, and in this case WRITE SAME will not be disabled.
So we should check error instead of r.

---
 drivers/md/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
index 6aa2592..3642d10 100644
@@ -791,7 +791,7 @@ static void clone_endio(struct bio *bio, int error)
 		}
 	}
 
-	if (unlikely(r == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) &&
+	if (unlikely(error == -EREMOTEIO && (bio->bi_rw & REQ_WRITE_SAME) &&
 		     !bdev_get_queue(bio->bi_bdev)->limits.max_write_same_sectors))
 		disable_write_same(md);
 
Signature · 1 line
1.8.4.3
#1 lore raw
Quoted 6 lines · alex chen

In the clone_endio, when target_type is linear and WRITE SAME bio fails, r will be always be initialized 0 because of null end_io, and in this case WRITE SAME will not be disabled.
So we should check error instead of r.

I've fixed it a bit differently (clone_endio now matches dm_done) and have staged it for 3.19, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=5164bece1673cdf04782f8ed3fba70743700f5da

Thanks.

author
#2 lore raw
Quoted 8 lines · Mike Snitzer
Quoted 5 lines · alex chen

In the clone_endio, when target_type is linear and WRITE SAME bio fails, r will be always be initialized 0 because of null end_io, and in this case WRITE SAME will not be disabled.
So we should check error instead of r.

Quoted 7 lines
Quoted 1 line

I've fixed it a bit differently (clone_endio now matches dm_done) and have staged it for 3.19, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=5164bece1673cdf04782f8ed3fba70743700f5da

Thanks.

OK, thank you!

Quoted 2 lines