public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: make sure to save mirror_num only if it is set
@ 2014-02-27 15:25 Josef Bacik
  0 siblings, 0 replies; only message in thread
From: Josef Bacik @ 2014-02-27 15:25 UTC (permalink / raw)
  To: linux-btrfs

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>
---
 disk-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 		}
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-27 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 15:25 [PATCH] Btrfs-progs: make sure to save mirror_num only if it is set Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox