Blame SOURCES/lvm2-2_02_155-fix-flushing-for-mirror-target.patch

35a342
 WHATS_NEW                  |  4 ++++
35a342
 lib/activate/activate.c    | 10 ++++++++++
35a342
 lib/activate/dev_manager.c | 13 +++++++------
35a342
 3 files changed, 21 insertions(+), 6 deletions(-)
35a342
35a342
diff --git a/WHATS_NEW b/WHATS_NEW
35a342
index 8c87a92..6441cc1 100644
35a342
--- a/WHATS_NEW
35a342
+++ b/WHATS_NEW
35a342
@@ -1,3 +1,7 @@
35a342
+Version 2.02.155 - 
35a342
+====================================
35a342
+  Fix flushing for mirror target.
35a342
+
35a342
 Version 2.02.142 - 
35a342
 ====================================
35a342
   Do not check for suspended devices if scanning for lvmetad update.
35a342
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
35a342
index 7d2adf1..8b0fcb3 100644
35a342
--- a/lib/activate/activate.c
35a342
+++ b/lib/activate/activate.c
35a342
@@ -1900,6 +1900,16 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
35a342
 		}
35a342
 	}
35a342
 
35a342
+	/* Flush is ATM required for the tested cases
35a342
+	 * NOTE: Mirror repair requires noflush for proper repair!
35a342
+	 * TODO: Relax this limiting condition further */
35a342
+	if (!flush_required &&
35a342
+	    (lv_is_pvmove(ondisk_lv) ||
35a342
+	    (!lv_is_mirror(ondisk_lv) && !lv_is_thin_pool(ondisk_lv) && !lv_is_thin_volume(ondisk_lv)))) {
35a342
+		log_debug("Requiring flush for LV %s.", display_lvname(ondisk_lv));
35a342
+		flush_required = 1;
35a342
+	}
35a342
+
35a342
 	if (!monitor_dev_for_events(cmd, ondisk_lv, laopts, 0))
35a342
 		/* FIXME Consider aborting here */
35a342
 		stack;
35a342
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
35a342
index e1f547f..c95dfbe 100644
35a342
--- a/lib/activate/dev_manager.c
35a342
+++ b/lib/activate/dev_manager.c
35a342
@@ -3277,7 +3277,7 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
35a342
 		break;
35a342
 	case SUSPEND:
35a342
 		dm_tree_skip_lockfs(root);
35a342
-		if (!dm->flush_required && !lv_is_pvmove(lv))
35a342
+		if (!dm->flush_required)
35a342
 			dm_tree_use_no_flush_suspend(root);
35a342
 		/* Fall through */
35a342
 	case SUSPEND_WITH_LOCKFS:
35a342
@@ -3298,12 +3298,11 @@ static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv,
35a342
 
35a342
 		if ((dm_tree_node_size_changed(root) < 0))
35a342
 			dm->flush_required = 1;
35a342
-
35a342
 		/* Currently keep the code require flush for any
35a342
-		 * non 'thin pool/volume, mirror' or with any size change */
35a342
-		if (!lv_is_thin_volume(lv) &&
35a342
-		    !lv_is_thin_pool(lv) &&
35a342
-		    (!lv_is_mirror(lv) || dm_tree_node_size_changed(root)))
35a342
+		 * non 'thin pool/volume' and  size increase */
35a342
+		else if (!lv_is_thin_volume(lv) &&
35a342
+			 !lv_is_thin_pool(lv) &&
35a342
+			 dm_tree_node_size_changed(root))
35a342
 			dm->flush_required = 1;
35a342
 
35a342
 		if (action == ACTIVATE) {
35a342
@@ -3347,6 +3346,8 @@ int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv
35a342
 int dev_manager_preload(struct dev_manager *dm, const struct logical_volume *lv,
35a342
 			struct lv_activate_opts *laopts, int *flush_required)
35a342
 {
35a342
+	dm->flush_required = *flush_required;
35a342
+
35a342
 	if (!_tree_action(dm, lv, laopts, PRELOAD))
35a342
 		return_0;
35a342