From 24ab6328f7d5a81dc313a08f71f83a4f7fc30e9b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 29 Feb 2012 22:08:57 +0000 Subject: [PATCH] Wipe initial 4KiB for non-zeroed thin volumes If the thin pool has disabled zeroing (created with -Zn), we at least clear initial 4KiB of such thin volume (provisions 1st block). If lvcreate is executed with '-an' command will abort (same way like we for normal LV - however for normal LV option -Zn may skip clearing completely, for thin volumes this option is not supported (applies only for pools). --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index c3657452e..82f964fc2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.94 - ==================================== + Use set_lv() (wipe initial 4KiB) for non zeroed thin volume. Allow cluster mirrors to handle the absence of the checkpoint lib (libSaCkpt). Revert free of allocated segtype in init segment error path (2.02.89). Test dm_hash_insert() failures in filter-persistent.c and fid_add_mda(). diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 82f3c65f9..513590f71 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -4457,7 +4457,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l if (!seg_is_thin(lp) && !lp->zero && !lp->snapshot) log_warn("WARNING: \"%s\" not zeroed", lv->name); - else if (!seg_is_thin(lp) && !set_lv(cmd, lv, UINT64_C(0), 0)) { + else if ((!seg_is_thin(lp) || + (lv_is_thin_volume(lv) && + !first_seg(first_seg(lv)->pool_lv)->zero_new_blocks)) && + !set_lv(cmd, lv, UINT64_C(0), 0)) { log_error("Aborting. Failed to wipe %s.", lp->snapshot ? "snapshot exception store" : "start of new LV");