[dm-devel] [PATCH] dm: check error instead of r in clone_endio

alex chen alex.chen at huawei.com
Wed Dec 17 06:37:04 UTC 2014


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.

Signed-off-by: Alex Chen <alex.chen at huawei.com>
---
 drivers/md/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 6aa2592..3642d10 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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);

-- 
1.8.4.3




More information about the dm-devel mailing list