mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

Blame SOURCES/lvm2-2_03_12-lvcreate-use-lv_passes_readonly_filter.patch

31f061
 WHATS_NEW               | 4 ++++
31f061
 lib/activate/activate.c | 5 +++++
31f061
 lib/activate/activate.h | 2 ++
31f061
 lib/metadata/lv_manip.c | 6 ++++++
31f061
 4 files changed, 17 insertions(+)
31f061
31f061
diff --git a/WHATS_NEW b/WHATS_NEW
31f061
index 3953c7e..c8f869c 100644
31f061
--- a/WHATS_NEW
31f061
+++ b/WHATS_NEW
31f061
@@ -1,5 +1,9 @@
31f061
 Version 2.03.12 - 
31f061
 ===================================
31f061
+  Check if lvcreate passes read_only_volume_list with tags and skips zeroing.
31f061
+  Limit pool metadata spare to 16GiB.
31f061
+  Improves conversion and allocation of pool metadata.
31f061
+  Support thin pool metadata 15.88GiB, adds 64MiB, thin_pool_crop_metadata=0.
31f061
   Fix problem with wiping of converted LVs.
31f061
   Fix memleak in scanning  (2.03.11).
31f061
   Fix corner case allocation for thin-pools.
31f061
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
31f061
index 7ed6441..de866fb 100644
31f061
--- a/lib/activate/activate.c
31f061
+++ b/lib/activate/activate.c
31f061
@@ -466,6 +466,11 @@ static int _passes_readonly_filter(struct cmd_context *cmd,
31f061
 	return _lv_passes_volumes_filter(cmd, lv, cn, activation_read_only_volume_list_CFG);
31f061
 }
31f061
 
31f061
+int lv_passes_readonly_filter(const struct logical_volume *lv)
31f061
+{
31f061
+	return _passes_readonly_filter(lv->vg->cmd, lv);
31f061
+}
31f061
+
31f061
 int library_version(char *version, size_t size)
31f061
 {
31f061
 	if (!activation())
31f061
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
31f061
index 3f4d128..53c8631 100644
31f061
--- a/lib/activate/activate.h
31f061
+++ b/lib/activate/activate.h
31f061
@@ -208,6 +208,8 @@ int lvs_in_vg_opened(const struct volume_group *vg);
31f061
 
31f061
 int lv_is_active(const struct logical_volume *lv);
31f061
 
31f061
+int lv_passes_readonly_filter(const struct logical_volume *lv);
31f061
+
31f061
 /* Check is any component LV is active */
31f061
 const struct logical_volume *lv_component_is_active(const struct logical_volume *lv);
31f061
 const struct logical_volume *lv_holder_is_active(const struct logical_volume *lv);
31f061
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
31f061
index 445c4ad..5ff64a3 100644
31f061
--- a/lib/metadata/lv_manip.c
31f061
+++ b/lib/metadata/lv_manip.c
31f061
@@ -7976,6 +7976,12 @@ static int _should_wipe_lv(struct lvcreate_params *lp,
31f061
 	     first_seg(first_seg(lv)->pool_lv)->zero_new_blocks))
31f061
 		return 0;
31f061
 
31f061
+	if (warn && (lv_passes_readonly_filter(lv))) {
31f061
+		log_warn("WARNING: Read-only activated logical volume %s not zeroed.",
31f061
+			 display_lvname(lv));
31f061
+		return 0;
31f061
+	}
31f061
+
31f061
 	/* Cannot zero read-only volume */
31f061
 	if ((lv->status & LVM_WRITE) &&
31f061
 	    (lp->zero || lp->wipe_signatures))