md: multipath: don't hardcopy bio in .make_request path
authorMing Lei <ming.lei@canonical.com>
Sat, 12 Mar 2016 01:29:40 +0000 (09:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Apr 2016 16:08:57 +0000 (09:08 -0700)
commit2775a60447ae12350711b443be1083117b6f13b8
tree7cf3a8749d3b7eea0d9b4bcc89cbd3d0e1dc4ce2
parentd5e30f2b934bf9964e1bf5fb1c1bd4d1bc865b5d
md: multipath: don't hardcopy bio in .make_request path

commit fafcde3ac1a418688a734365203a12483b83907a upstream.

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.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/multipath.c