Skip to content

Commit 5164bec

Browse files
zhendong chensnitm
authored andcommitted
dm: fix missed error code if .end_io isn't implemented by target_type
In bio-based DM's clone_endio(), when target_type doesn't implement .end_io (e.g. linear) r will be always be initialized 0. So if a WRITE SAME bio fails WRITE SAME will not be disabled as intended. Fix this by initializing r to error, rather than 0, in clone_endio(). Signed-off-by: Alex Chen <alex.chen@huawei.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Fixes: 7eee4ae ("dm: disable WRITE SAME if it fails") Cc: stable@vger.kernel.org
1 parent 2b94e89 commit 5164bec

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/md/dm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static void disable_write_same(struct mapped_device *md)
899899

900900
static void clone_endio(struct bio *bio, int error)
901901
{
902-
int r = 0;
902+
int r = error;
903903
struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
904904
struct dm_io *io = tio->io;
905905
struct mapped_device *md = tio->io->md;

0 commit comments

Comments
 (0)