From: Josef Bacik Date: Thu, 27 Feb 2014 15:25:49 +0000 (-0500) Subject: Btrfs-progs: make sure to save mirror_num only if it is set X-Git-Tag: upstream/4.16.1~2934 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4bcfcb47faaf1adc912be64892e01b92b377c8c5;p=platform%2Fupstream%2Fbtrfs-progs.git 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 Signed-off-by: David Sterba Signed-off-by: Chris Mason --- diff --git a/disk-io.c b/disk-io.c index e840177..0bd1bb0 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; }