summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-02-27 10:25:49 -0500
committerChris Mason <clm@fb.com>2014-03-21 06:23:31 -0700
commit4bcfcb47faaf1adc912be64892e01b92b377c8c5 (patch)
tree85d17b22eaed367bf07e5f682c8bd080fd7a22bd /disk-io.c
parent47c18d17c52b452a9516c1943d9c2b0fa7902b5a (diff)
Btrfs-progs: make sure to save mirror_num only if it is set
If we are cycling through all of the mirrors trying to find the best one we need to make sure we set best_mirror to an actual mirror number and not 0. Otherwise we could end up reading a mirror that wasn't the best and make everybody sad. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/disk-io.c b/disk-io.c
index e840177f..0bd1bb01 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -297,7 +297,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
ignore = 1;
continue;
}
- if (btrfs_header_generation(eb) > best_transid) {
+ if (btrfs_header_generation(eb) > best_transid && mirror_num) {
best_transid = btrfs_header_generation(eb);
good_mirror = mirror_num;
}