mrc0mmand / rpms / lvm2

Forked from rpms/lvm2 2 years ago
Clone

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

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