diff options
author | Qu Wenruo <wqu@suse.com> | 2018-03-30 15:35:27 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-03-30 22:15:55 +0200 |
commit | 6af3cc08ddb5c0165d357ffa36422c2716ebd2a0 (patch) | |
tree | 4ad8a9052ea55afd13deff5c36fcb49d8ebf1078 /send-stream.h | |
parent | 64f3dc013676544d3f6142a80cfef99644e4e49a (diff) |
btrfs-progs: convert: Fix offset-by-one error in read_data_extent()
For read_data_extent() in convert/main.c it's using mirror number in a
incorrect way, which will not get correct copy for RAID1:
for (cur_mirror = 0; cur_mirror < num_copies; cur_mirror++) {
In such case, for RAID1 @cur_mirror will only be 0 and 1.
However for 0 and 1 case, btrfs_map_block() will only return the first
copy. To reach the 2nd copy, it correct @cur_mirror range should be 1
and 2.
So with this off-by-one error, btrfs-image will never be able to read
out data extent if the first stripe of the chunk is the missing one.
Fix it by starting @cur_mirror from 1 and to @num_copies (including).
Fixes: 2d46558b30f5 ("btrfs-progs: Use existing facility to replace read_data_extent function")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'send-stream.h')
0 files changed, 0 insertions, 0 deletions