dm: check error instead of r in clone_endio
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
@@ -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
Quoted 6 lines · alex chen
In the
clone_endio, whentarget_typeis linear and WRITE SAME bio fails, r will be always be initialized 0 because of nullend_io, and in this case WRITE SAME will not be disabled.
So we should check error instead of r.Signed-off-by Alex Chen <[email protected]>
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.
Quoted 8 lines · Mike Snitzer
Quoted 5 lines · alex chen
In the
clone_endio, whentarget_typeis linear and WRITE SAME bio fails, r will be always be initialized 0 because of nullend_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
Signed-off-by Alex Chen <[email protected]>I've fixed it a bit differently (
clone_endionow matchesdm_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=5164bece1673cdf04782f8ed3fba70743700f5daThanks.
OK, thank you!