From 955da3f982abe05e238c75ffb1b774e62455dda7 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 2 Mar 2014 17:12:42 +0100 Subject: [PATCH] Avoids duplicate recovery attempts when data is synched. Conflicts: check.c --- check.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/check.c b/check.c index 73e0c225..bd111096 100644 --- a/check.c +++ b/check.c @@ -274,6 +274,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign unsigned j; int n; int something_to_recover; + int something_unsynched; error = 0; @@ -389,6 +390,7 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign /* and we are not interested to recover DELETED ones. */ n = 0; something_to_recover = 0; /* keep track if there is at least one block to fix */ + something_unsynched = 0; /* keep track if we have some unsynched info to process */ for(j=0;jhash, buffer[failed[j].index]) == 0) { @@ -447,7 +450,8 @@ static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsign } /* if nothing to fix, we just don't try */ - if (something_to_recover) { + /* if nothing unsynched we also don't retry, because it's the same try as before */ + if (something_to_recover && something_unsynched) { ret = repair_step(state, rehash, pos, diskmax, failed, failed_map, n, buffer, buffer_recov, buffer_zero); if (ret == 0) { /* we alreay marked as outdated NEW and CHG blocks, we don't need to do it again */