Skip to contentSkip to conversation

Btrfs-progs: make sure to save mirror_num only if it is set

PATCH New Josef Bacik 1 participant 1 message Feb 27, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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,

---
 disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
disk-io.c +1 -1
index e840177..0bd1bb0 100644
@@ -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;
 		}
Signature · 1 line
1.8.3.1