diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-02-12 16:37:30 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-02-17 11:00:05 -0500 |
commit | d73f9907294c670da14baea3fb31be27879e818e (patch) | |
tree | aebcc204b06a8c68b003adb66623281a7fc00840 /mm | |
parent | 4d1662a30dde6e545086fe0e8fd7e474c4e0b639 (diff) | |
download | linux-d73f9907294c670da14baea3fb31be27879e818e.tar.gz linux-d73f9907294c670da14baea3fb31be27879e818e.tar.bz2 linux-d73f9907294c670da14baea3fb31be27879e818e.zip |
dm io: fix I/O to multiple destinations
Commit 003b5c5719f159f4f4bf97511c4702a0638313dd ("block: Convert drivers
to immutable biovecs") broke dm-mirror due to dm-io breakage.
dm-io had three possible iterators (DM_IO_PAGE_LIST, DM_IO_BVEC,
DM_IO_VMA) that iterate over pages where the I/O should be performed.
The switch to immutable biovecs changed the DM_IO_BVEC iterator to
DM_IO_BIO. Before this change the iterator stored the pointer to a bio
vector in the dpages structure. The iterator incremented the pointer in
the dpages structure as it advanced over the pages. After the immutable
biovecs change, the DM_IO_BIO iterator stores a pointer to the bio in
the dpages structure and uses bio_advance to change the bio as it
advances.
The problem is that the function dispatch_io stores the content of the
dpages structure into the variable old_pages and restores it before
issuing I/O to each of the devices. Before the change, the statement
"*dp = old_pages;" restored the iterator to its starting position.
After the change, struct dpages holds a pointer to the bio, thus the
statement "*dp = old_pages;" doesn't restore the iterator.
Consequently, in the context of dm-mirror: only the first mirror leg is
written correctly, the kernel locks up when trying to write the other
mirror legs because the number of sectors to write in the where->count
variable doesn't match the number of sectors returned by the iterator.
This patch fixes the bug by partially reverting the original patch - it
changes the code so that struct dpages holds a pointer to the bio vector,
so that the statement "*dp = old_pages;" restores the iterator correctly.
The field "context_u" holds the offset from the beginning of the current
bio vector entry, just like the "bio->bi_iter.bi_bvec_done" field.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions