[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 3/3] Return error if _percent_run is unable to get a percentage.



The original behavior of assuming the percentage is 100% leads to
endless polling in the case of snapshot-merge.  This happens when one
polldaemon is racing with another (polling the same LV).  The first to
see the LV status reach the "finished" state will alter the LV that the
other polldaemon(s) are polling.
---
 lib/activate/dev_manager.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 25b7a10..25160e3 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -509,18 +509,12 @@ static int _percent_run(struct dev_manager *dm, const char *name,
 	if (total_denominator) {
 		*percent = (float) total_numerator *100 / total_denominator;
 		*overall_percent_range = combined_percent_range;
-	} else {
+	} else if (!first_time) {
 		*percent = 100;
-		if (first_time) {
-			/* above ->target_percent() was not executed! */
-			/* FIXME why return PERCENT_100 et. al. in this case? */
-			*overall_percent_range = PERCENT_100;
-			if (lv && lv_is_merging_origin(lv)) {
-				/* must fail in snapshot-merge case */
-				goto_out;
-			}
-		} else
-			*overall_percent_range = combined_percent_range;
+		*overall_percent_range = combined_percent_range;
+	} else {
+		/* above ->target_percent() was not executed! */
+		goto_out;
 	}
 
 	log_debug("LV percent: %f", *percent);
-- 
1.6.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]