Commit 09e20944 authored by zhendong chen's avatar zhendong chen Committed by Luis Henriques

dm: fix missed error code if .end_io isn't implemented by target_type

commit 5164bece upstream.

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: default avatarAlex Chen <alex.chen@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Fixes: 7eee4ae2 ("dm: disable WRITE SAME if it fails")
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent e6051f0a
......@@ -776,7 +776,7 @@ static void disable_write_same(struct mapped_device *md)
static void clone_endio(struct bio *bio, int error)
{
int r = 0;
int r = error;
struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone);
struct dm_io *io = tio->io;
struct mapped_device *md = tio->io->md;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment