diff options
author | Ming Lei <ming.lei@canonical.com> | 2016-03-12 09:29:40 +0800 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-04-18 08:49:31 -0400 |
commit | 015e566a0e0d9bcd2b0538d001e65e0b63d3d5ff (patch) | |
tree | dad689e24a85c68fb4dafb2209fbc6f54eaea925 | |
parent | ef8259645a0592cdf37ecbc466806d7e78248d5a (diff) | |
download | lwn-015e566a0e0d9bcd2b0538d001e65e0b63d3d5ff.tar.gz lwn-015e566a0e0d9bcd2b0538d001e65e0b63d3d5ff.zip |
md: multipath: don't hardcopy bio in .make_request path
[ Upstream commit fafcde3ac1a418688a734365203a12483b83907a ]
Inside multipath_make_request(), multipath maps the incoming
bio into low level device's bio, but it is totally wrong to
copy the bio into mapped bio via '*mapped_bio = *bio'. For
example, .__bi_remaining is kept in the copy, especially if
the incoming bio is chained to via bio splitting, so .bi_end_io
can't be called for the mapped bio at all in the completing path
in this kind of situation.
This patch fixes the issue by using clone style.
Cc: stable@vger.kernel.org (v3.14+)
Reported-and-tested-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r-- | drivers/md/multipath.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 399272f9c042..2df218da1791 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -129,7 +129,9 @@ static void multipath_make_request(struct mddev *mddev, struct bio * bio) } multipath = conf->multipaths + mp_bh->path; - mp_bh->bio = *bio; + bio_init(&mp_bh->bio); + __bio_clone_fast(&mp_bh->bio, bio); + mp_bh->bio.bi_iter.bi_sector += multipath->rdev->data_offset; mp_bh->bio.bi_bdev = multipath->rdev->bdev; mp_bh->bio.bi_rw |= REQ_FAILFAST_TRANSPORT; |