master - metadata: Avoid accessing ignored metadata.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=52fd66210b120bf1185...
Commit: 52fd66210b120bf1185fbbc91b6bc487d99dd33a
Parent: 84aca4201e3588159e75fa8e047e997c2fad13d2
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Oct 27 22:42:00 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Oct 27 22:53:43 2017 +0100
metadata: Avoid accessing ignored metadata.
When an ignored metadata area gets flagged for use again, make sure the
code doesn't try to parse its old metadata. Firstly by trying to detect
this situation and skipping the read (while still remembering the
position reached in the circular buffer), and secondly by clearing the
invalid live metadata location on disk as a precaution when subsequently
writing out the precommitted metadata.
Problems showed up when a metadata area in one VG got moved to
another VG in ignored state (still holding metadata for the original
VG) and then later got brought into use in the new VG - only the header
should be read in this case, not any of the metadata content.
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 28 ++++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3e13d8c..4d1a6a8 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Avoid reading ignored metadata when mda gets used again.
Fix detection of moved PVs in vgsplit. (2.02.175)
Ignore --stripes/--stripesize on RAID takeover
Improve used paths for generated systemd units and init shells.
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 3e1ca19..797ead0 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -414,12 +414,15 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
struct lvmcache_vgsummary vgsummary_orphan = {
.vgname = FMT_TEXT_ORPHAN_VG_NAME,
};
+ int rlocn_was_ignored;
memcpy(&vgsummary_orphan.vgid, FMT_TEXT_ORPHAN_VG_NAME, sizeof(FMT_TEXT_ORPHAN_VG_NAME));
rlocn = mdah->raw_locns; /* Slot 0 */
rlocn_precommitted = rlocn + 1; /* Slot 1 */
+ rlocn_was_ignored = rlocn_is_ignored(rlocn);
+
/* Should we use precommitted metadata? */
if (*precommitted && rlocn_precommitted->size &&
(rlocn_precommitted->offset != rlocn->offset)) {
@@ -438,6 +441,12 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
if (!*vgname)
return rlocn;
+ /*
+ * If live rlocn has ignored flag, data will be out-of-date so skip further checks.
+ */
+ if (rlocn_was_ignored)
+ return rlocn;
+
/* FIXME Loop through rlocns two-at-a-time. List null-terminated. */
/* FIXME Ignore if checksum incorrect!!! */
if (!dev_read(dev_area->dev, dev_area->start + rlocn->offset,
@@ -448,8 +457,9 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
return rlocn;
- log_debug_metadata("Volume group name found in metadata on %s at %" PRIu64 " does "
+ log_debug_metadata("Volume group name found in %smetadata on %s at %" PRIu64 " does "
"not match expected name %s.",
+ *precommitted ? "precommitted " : "",
dev_name(dev_area->dev), dev_area->start + rlocn->offset, vgname);
bad:
@@ -750,6 +760,14 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid,
mdah->raw_locns[2].size = 0;
mdah->raw_locns[2].checksum = 0;
rlocn = &mdah->raw_locns[0];
+ } else if (precommit && rlocn_is_ignored(rlocn) && !mda_is_ignored(mda)) {
+ /*
+ * If precommitting into a previously-ignored mda, wipe the live rlocn
+ * as a precaution so that nothing can use it by mistake.
+ */
+ mdah->raw_locns[0].offset = 0;
+ mdah->raw_locns[0].size = 0;
+ mdah->raw_locns[0].checksum = 0;
}
if (precommit)
@@ -766,12 +784,14 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid,
rlocn->offset = mdac->rlocn.offset;
rlocn->size = mdac->rlocn.size;
rlocn->checksum = mdac->rlocn.checksum;
- log_debug_metadata("%sCommitting %s metadata (%u) to %s header at %"
- PRIu64, precommit ? "Pre-" : "", vg->name, vg->seqno,
+ log_debug_metadata("%sCommitting %s %smetadata (%u) to %s header at %"
+ PRIu64, precommit ? "Pre-" : "", vg->name,
+ mda_is_ignored(mda) ? "(ignored) " : "", vg->seqno,
dev_name(mdac->area.dev), mdac->area.start);
} else
- log_debug_metadata("Wiping pre-committed %s metadata from %s "
+ log_debug_metadata("Wiping pre-committed %s %smetadata from %s "
"header at %" PRIu64, vg->name,
+ mda_is_ignored(mda) ? "(ignored) " : "",
dev_name(mdac->area.dev), mdac->area.start);
rlocn_set_ignored(mdah->raw_locns, mda_is_ignored(mda));
6 years, 5 months
master - vgsplit: Fix detection of moved PVs.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=84aca4201e3588159e7...
Commit: 84aca4201e3588159e75fa8e047e997c2fad13d2
Parent: eb710cced11a290ebe3e365e3b1cc225920b6b99
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Oct 27 21:38:16 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Oct 27 22:53:43 2017 +0100
vgsplit: Fix detection of moved PVs.
vgsplit shares the vg_rename code so that must only set the PV_MOVED_VG
flag introduced in commit 486ed108481cfbe4336f0fa590cbae251188ecc6
("vgmerge: Fix intermediate metadata corruption") on PVs that moved.
---
WHATS_NEW | 1 +
lib/config/config.c | 2 +-
lib/metadata/metadata.c | 8 +++++++-
tools/vgmerge.c | 1 +
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index fbf8732..3e13d8c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Fix detection of moved PVs in vgsplit. (2.02.175)
Ignore --stripes/--stripesize on RAID takeover
Improve used paths for generated systemd units and init shells.
Disallow creation of snapshot of mirror/raid subLV (was never supported).
diff --git a/lib/config/config.c b/lib/config/config.c
index 1f18969..e8e330b 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -542,7 +542,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
if (checksum_fn && checksum !=
(checksum_fn(checksum_fn(INITIAL_CRC, (const uint8_t *)fb, size),
(const uint8_t *)(fb + size), size2))) {
- log_error("%s: Checksum error", dev_name(dev));
+ log_error("%s: Checksum error at offset %" PRIu64, dev_name(dev), (uint64_t) offset);
goto out;
}
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index bcc23bc..2a9819d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -512,13 +512,19 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
}
dm_list_iterate_items(pvl, &vg->pvs) {
+ /* Skip if VG didn't change e.g. with vgsplit */
+ if (pvl->pv->vg_name && !strcmp(new_name, pvl->pv->vg_name))
+ continue;
+
if (!(pvl->pv->vg_name = dm_pool_strdup(mem, new_name))) {
log_error("pv->vg_name allocation failed for '%s'",
pv_dev_name(pvl->pv));
return 0;
}
+
/* Mark the PVs that still hold metadata with the old VG name */
- pvl->pv->status |= PV_MOVED_VG;
+ log_debug_metadata("Marking PV %s as moved to VG %s", dev_name(pvl->pv->dev), new_name);
+ pvl->pv->status |= PV_MOVED_VG;
}
return 1;
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
index 86c6a48..013bef4 100644
--- a/tools/vgmerge.c
+++ b/tools/vgmerge.c
@@ -112,6 +112,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
add_pvl_to_vgs(vg_to, pvl);
pvl->pv->vg_name = dm_pool_strdup(cmd->mem, vg_to->name);
/* Mark the VGs that still hold metadata for the old VG */
+ log_debug_metadata("Marking PV %s as moved to VG %s", dev_name(pvl->pv->dev), vg_to->name);
pvl->pv->status |= PV_MOVED_VG;
}
6 years, 5 months
master - tests: update checked messages
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eb710cced11a290ebe3...
Commit: eb710cced11a290ebe3e365e3b1cc225920b6b99
Parent: 63c50ced89d14f90c3202167e1d07de3514dad60
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 27 17:02:22 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 27 17:07:42 2017 +0200
tests: update checked messages
---
test/shell/lvconvert-snapshot-cache.sh | 6 +++---
test/shell/lvconvert-snapshot-mirror.sh | 4 ++--
test/shell/lvconvert-snapshot-raid.sh | 4 ++--
test/shell/lvconvert-snapshot-thin.sh | 13 ++++++++++---
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/test/shell/lvconvert-snapshot-cache.sh b/test/shell/lvconvert-snapshot-cache.sh
index 0d9c9c6..d32f4c2 100644
--- a/test/shell/lvconvert-snapshot-cache.sh
+++ b/test/shell/lvconvert-snapshot-cache.sh
@@ -58,13 +58,13 @@ grep "lv_is_visible" err
# Cannot use thin-pool, _tdata, _tmeta as origin
not lvconvert --yes --type snapshot $vg/cpool $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
not lvconvert --yes --type snapshot $vg/cpool_cdata $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
not lvconvert --yes --type snapshot $vg/cpool_cmeta $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
lvconvert --yes -s $vg/ch $vg/cow
diff --git a/test/shell/lvconvert-snapshot-mirror.sh b/test/shell/lvconvert-snapshot-mirror.sh
index 01c19d9..22f40f7 100644
--- a/test/shell/lvconvert-snapshot-mirror.sh
+++ b/test/shell/lvconvert-snapshot-mirror.sh
@@ -42,11 +42,11 @@ grep "lv_is_visible" err
# cannot use _mimage
not lvconvert --yes --type snapshot $vg/mir_mimage_0 $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
# cannot use _mlog
not lvconvert --yes --type snapshot $vg/mir_mlog $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
lvconvert --yes -s $vg/mir $vg/cow
diff --git a/test/shell/lvconvert-snapshot-raid.sh b/test/shell/lvconvert-snapshot-raid.sh
index 91bcd94..8deb60f 100644
--- a/test/shell/lvconvert-snapshot-raid.sh
+++ b/test/shell/lvconvert-snapshot-raid.sh
@@ -44,11 +44,11 @@ grep "lv_is_visible" err
# Cannot use _rimage
not lvconvert --yes --type snapshot $vg/rd_rimage_0 $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
# Cannot use _rmeta
not lvconvert --yes --type snapshot $vg/rd_rmeta_0 $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
lvconvert --yes -s $vg/rd $vg/cow
diff --git a/test/shell/lvconvert-snapshot-thin.sh b/test/shell/lvconvert-snapshot-thin.sh
index ef1218b..f5da459 100644
--- a/test/shell/lvconvert-snapshot-thin.sh
+++ b/test/shell/lvconvert-snapshot-thin.sh
@@ -29,6 +29,7 @@ lvcreate -L1 -n cow $vg
# Thin and snapshot conversion
lvcreate -T -L1 -V10 -n th $vg/pool
+eval $(lvs -S 'name=~_pmspare' -a -o name --config 'report/mark_hidden_devices=0' --noheading --nameprefixes $vg)
# Cannot create snapshot of pool's meta
not lvcreate -s -L1 $vg/pool_tmeta 2>&1 | tee err
@@ -45,6 +46,9 @@ grep "not accept" err
not lvconvert --yes --type snapshot $vg/cow $vg/pool 2>&1 | tee err
grep "not accept" err
+not lvconvert --yes --type snapshot $vg/cow $vg/$LVM2_LV_NAME 2>&1 | tee err
+grep "lv_is_visible" err
+
not lvconvert --yes --type snapshot $vg/cow $vg/pool_tdata 2>&1 | tee err
grep "lv_is_visible" err
@@ -53,13 +57,16 @@ grep "lv_is_visible" err
# Cannot use thin-pool, _tdata, _tmeta as origin
not lvconvert --yes --type snapshot $vg/pool $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
+
+not lvconvert --yes --type snapshot $vg/$LVM2_LV_NAME $vg/cow 2>&1 | tee err
+grep "not supported" err
not lvconvert --yes --type snapshot $vg/pool_tdata $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
not lvconvert --yes --type snapshot $vg/pool_tmeta $vg/cow 2>&1 | tee err
-grep "invalid" err
+grep "not supported" err
lvconvert --yes -s $vg/th $vg/cow
6 years, 5 months
master - snapshot: relocate common code validation for snapshot origin
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=63c50ced89d14f90c32...
Commit: 63c50ced89d14f90c3202167e1d07de3514dad60
Parent: 0c68c19c322e23242b21885d759ab5ec3bbe8e08
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 27 16:48:57 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 27 17:07:42 2017 +0200
snapshot: relocate common code validation for snapshot origin
Since both lvcreate and lvconvert needs to check for same
type of allowed origin for snapshot - move the code into
a single function.
This way we also fix several inconsitencies where snapshot
has been allowed by mistake either through lvcreate or
lvconvert path.
---
lib/metadata/lv_manip.c | 51 +------------------------------------
lib/metadata/metadata-exported.h | 3 ++
lib/metadata/snapshot_manip.c | 44 ++++++++++++++++++++++++++++++++
tools/lvconvert.c | 33 ++++++++----------------
4 files changed, 60 insertions(+), 71 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 4cca5a1..01ba564 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7592,56 +7592,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
"Use --virtualsize.");
return NULL;
}
- if (lv_is_cow(origin_lv)) {
- log_error("Snapshots of snapshots are not supported.");
- return NULL;
- }
- if (lv_is_locked(origin_lv)) {
- log_error("Snapshots of locked devices are not supported.");
- return NULL;
- }
- if (lv_is_merging_origin(origin_lv)) {
- log_error("Snapshots of an origin that has a "
- "merging snapshot is not supported");
- return NULL;
- }
-
- if (lv_is_cache_type(origin_lv) && !lv_is_cache(origin_lv)) {
- log_error("Snapshots of cache type volume %s "
- "is not supported.", display_lvname(origin_lv));
- return NULL;
- }
- if (lv_is_thin_type(origin_lv) && !lv_is_thin_volume(origin_lv)) {
- log_error("Snapshots of thin pool %sdevices "
- "are not supported.",
- lv_is_thin_pool_data(origin_lv) ? "data " :
- lv_is_thin_pool_metadata(origin_lv) ?
- "metadata " : "");
- return NULL;
- }
-
- if (lv_is_mirror_type(origin_lv)) {
- if (!lv_is_mirror(origin_lv)) {
- log_error("Snapshots of mirror subvolumes are not supported.");
- return NULL;
- }
- log_warn("WARNING: Snapshots of mirrors can deadlock under rare device failures.");
- log_warn("WARNING: Consider using the raid1 mirror type to avoid this.");
- log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
- }
-
- if (lv_is_raid_type(origin_lv) && !lv_is_raid(origin_lv)) {
- log_error("Snapshots of raid subvolumes are not supported.");
- return NULL;
- }
-
- if (vg_is_clustered(vg) && lv_is_active(origin_lv) &&
- !lv_is_active_exclusive_locally(origin_lv)) {
- log_error("%s must be active exclusively to"
- " create snapshot", origin_lv->name);
- return NULL;
- }
+ if (!validate_snapshot_origin(origin_lv))
+ return_0;
}
if (!cow_has_min_chunks(vg, lp->extents, lp->chunk_size))
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 85e5838..71df955 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1074,6 +1074,9 @@ int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow,
int vg_remove_snapshot(struct logical_volume *cow);
+int validate_snapshot_origin(const struct logical_volume *origin_lv);
+
+
int vg_check_status(const struct volume_group *vg, uint64_t status);
int vg_check_pv_dev_block_sizes(const struct volume_group *vg);
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 57fbef9..8357ea0 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -386,3 +386,47 @@ int vg_remove_snapshot(struct logical_volume *cow)
return 1;
}
+
+/* Check if given LV is usable as snapshot origin LV */
+int validate_snapshot_origin(const struct logical_volume *origin_lv)
+{
+ const char *err = NULL; /* For error string */
+
+ if (lv_is_cow(origin_lv))
+ err = "snapshots";
+ else if (lv_is_locked(origin_lv))
+ err = "locked volumes";
+ else if (lv_is_pvmove(origin_lv))
+ err = "pvmoved volumes";
+ else if (!lv_is_visible(origin_lv))
+ err = "hidden volumes";
+ else if (lv_is_merging_origin(origin_lv))
+ err = "an origin that has a merging snapshot";
+ else if (lv_is_cache_type(origin_lv) && !lv_is_cache(origin_lv))
+ err = "cache type volumes";
+ else if (lv_is_thin_type(origin_lv) && !lv_is_thin_volume(origin_lv))
+ err = "thin pool type volumes";
+ else if (lv_is_mirror_type(origin_lv)) {
+ if (!lv_is_mirror(origin_lv))
+ err = "mirror subvolumes";
+ else {
+ log_warn("WARNING: Snapshots of mirrors can deadlock under rare device failures.");
+ log_warn("WARNING: Consider using the raid1 mirror type to avoid this.");
+ log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
+ }
+ } else if (lv_is_raid_type(origin_lv) && !lv_is_raid(origin_lv))
+ err = "raid subvolumes";
+
+ if (err) {
+ log_error("Snapshots of %s are not supported.", err);
+ return 0;
+ }
+
+ if (vg_is_clustered(origin_lv->vg) && lv_is_active(origin_lv) &&
+ !lv_is_active_exclusive_locally(origin_lv)) {
+ log_error("Snapshot origin must be active exclusively.");
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index aa61f73..76be5cb 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1909,13 +1909,7 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
uint32_t chunk_size;
int zero;
- if (!(org = find_lv(lv->vg, origin_name))) {
- log_error("Couldn't find origin volume %s in Volume group %s.",
- origin_name, lv->vg->name);
- return 0;
- }
-
- if (org == lv) {
+ if (strcmp(lv->name, origin_name) == 0) {
log_error("Unable to use %s as both snapshot and origin.", snap_name);
return 0;
}
@@ -1925,34 +1919,29 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
log_error("Chunk size must be a power of 2 in the range 4K to 512K.");
return 0;
}
- log_verbose("Setting chunk size to %s.", display_size(cmd, chunk_size));
if (!cow_has_min_chunks(lv->vg, lv->le_count, chunk_size))
return_0;
+ log_verbose("Setting chunk size to %s.", display_size(cmd, chunk_size));
+
+ if (!(org = find_lv(lv->vg, origin_name))) {
+ log_error("Couldn't find origin volume %s in Volume group %s.",
+ origin_name, lv->vg->name);
+ return 0;
+ }
+
/*
* check_lv_rules() checks cannot be done via command definition
* rules because this LV is not processed by process_each_lv.
*/
- if (lv_is_locked(org) || lv_is_pvmove(org)) {
- log_error("Unable to use LV %s as snapshot origin: LV is %s.",
- display_lvname(lv), lv_is_locked(org) ? "locked" : "pvmove");
- return 0;
- }
/*
* check_lv_types() checks cannot be done via command definition
* LV_foo specification because this LV is not processed by process_each_lv.
*/
- if ((lv_is_cache_type(org) && !lv_is_cache(org)) ||
- (lv_is_thin_type(org) && !lv_is_thin_volume(org)) ||
- (lv_is_mirror_type(org) && !lv_is_mirror(org)) ||
- (lv_is_raid_type(org) && !lv_is_raid(org)) ||
- lv_is_cow(org)) {
- log_error("Unable to use LV %s as snapshot origin: invalid LV type.",
- display_lvname(lv));
- return 0;
- }
+ if (!validate_snapshot_origin(org))
+ return_0;
log_warn("WARNING: Converting logical volume %s to snapshot exception store.",
snap_name);
6 years, 5 months
master - man: Makefiles with V=1 support
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0c68c19c322e23242b2...
Commit: 0c68c19c322e23242b21885d759ab5ec3bbe8e08
Parent: 4b0f6829f63d36b473f6670a41ac7521ff82674d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 27 16:44:11 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 27 17:05:15 2017 +0200
man: Makefiles with V=1 support
Generation of man pages is generating lot of barely readable output.
For normal build quietize this a bit.
For original verbose build start to use 'make V=1'
(just like i.e. linux kernel does)
TODO: apply at more places...
---
man/Makefile.in | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/man/Makefile.in b/man/Makefile.in
index b8f3aeb..cd1106f 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -46,6 +46,19 @@ MAN8DM=dmsetup.8 dmstats.8
MAN8CLUSTER=
MAN8SYSTEMD_GENERATORS=lvm2-activation-generator.8
+ifeq ("$(origin V)", "command line")
+ BUILD_VERBOSE = $(V)
+endif
+ifndef BUILD_VERBOSE
+ BUILD_VERBOSE = 0
+endif
+
+ifeq ($(BUILD_VERBOSE),1)
+ Q =
+else
+ Q = @
+endif
+
ifeq ($(MAKECMDGOALS),all_man)
MAN_ALL="yes"
@@ -151,14 +164,14 @@ SEE_ALSO=$(srcdir)/see_also.end
.PRECIOUS: %.8_gen
%.8_gen: $(srcdir)/%.8_des $(srcdir)/%.8_end $(MANGENERATOR) $(TESTMAN)
- @( \
+ $(Q)( \
if [ ! -s $(TESTMAN) ] ; then \
echo "Copying pre-generated template $@" ; \
else \
echo "Generating template $@" ; \
fi \
)
- set -e ; ( \
+ $(Q)set -e ; ( \
if [ ! -s $(TESTMAN) ] ; then \
cat $(srcdir)/$(@:%.8_gen=%.8_pregen) ; \
else \
@@ -171,8 +184,8 @@ SEE_ALSO=$(srcdir)/see_also.end
) > $@
define SUBSTVARS
-echo "Generating $@"
-$(SED) -e "s+#VERSION#+$(LVM_VERSION)+" \
+$(Q)echo "Generating $@"
+$(Q)$(SED) -e "s+#VERSION#+$(LVM_VERSION)+" \
-e "s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+" \
-e "s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+" \
-e "s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+" \
@@ -197,7 +210,7 @@ endef
# - in "$vg-$lv"
# - in single one in '\\f.-'
define ESCAPEHYPHENS
-$(SED) -i -e "s+\([ [:alpha:]]\)-\{7\}+\1\\\-\\\-\\\-\\\-\\\-\\\-\\\-+g" \
+$(Q)$(SED) -i -e "s+\([ [:alpha:]]\)-\{7\}+\1\\\-\\\-\\\-\\\-\\\-\\\-\\\-+g" \
-e "s+\([ [:alpha:]]\)-\{6\}+\1\\\-\\\-\\\-\\\-\\\-\\\-+g" \
-e "s+\([ [:alpha:]]\)-\{5\}+\1\\\-\\\-\\\-\\\-\\\-+g" \
-e "s+\([ [:alpha:]]\)-\{4\}+\1\\\-\\\-\\\-\\\-+g" \
6 years, 5 months
master - dmsetup: Add unknown device error to dmsetup status.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b0f6829f63d36b473f...
Commit: 4b0f6829f63d36b473f6670a41ac7521ff82674d
Parent: fdcc709ed0e5051f471ee64ac51f6c8e2ed941fc
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Oct 26 17:47:13 2017 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Oct 26 17:47:13 2017 +0100
dmsetup: Add unknown device error to dmsetup status.
Treat status the same way as info if provided device name doesn't exist.
---
WHATS_NEW_DM | 1 +
tools/dmsetup.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index b0dd01b..6475fbd 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.145 -
===================================
+ Issue a specific error with dmsetup status if device is unknown.
Fix RT_LIBS reference in generated libdevmapper.pc for pkg-config
Version 1.02.144 - 6th October 2017
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 661910f..53097b3 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2431,9 +2431,14 @@ static int _status(CMD_ARGS)
if (!_task_run(dmt))
goto_out;
- if (!dm_task_get_info(dmt, &info) || !info.exists)
+ if (!dm_task_get_info(dmt, &info))
goto_out;
+ if (!info.exists) {
+ fprintf(stderr, "Device does not exist.\n");
+ goto_out;
+ }
+
if (!name)
name = dm_task_get_name(dmt);
6 years, 5 months
master - WHATS_NEW: ignore stripes/stripesize on RAID takover
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fdcc709ed0e5051f471...
Commit: fdcc709ed0e5051f471ee64ac51f6c8e2ed941fc
Parent: adb80816fbd95215ffc18fdfe5901abed25787c2
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Oct 26 18:18:24 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Oct 26 18:18:24 2017 +0200
WHATS_NEW: ignore stripes/stripesize on RAID takover
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 55e06f6..fbf8732 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
+ Ignore --stripes/--stripesize on RAID takeover
Improve used paths for generated systemd units and init shells.
Disallow creation of snapshot of mirror/raid subLV (was never supported).
Fix regression in more advanced vgname extraction in lvconvert (2.02.169).
6 years, 5 months
master - lvcreate: error message with dot.
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=adb80816fbd95215ffc...
Commit: adb80816fbd95215ffc18fdfe5901abed25787c2
Parent: 4a3884245d02bcdad41e4dd99f9201721c60158f
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Oct 26 17:25:22 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Oct 26 17:25:22 2017 +0200
lvcreate: error message with dot.
---
tools/lvcreate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index ff57baf..09bbe10 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -643,7 +643,7 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
}
if ((lp->nosync = arg_is_set(cmd, nosync_ARG)) && seg_is_any_raid6(lp)) {
- log_error("nosync option prohibited on RAID6");
+ log_error("nosync option prohibited on RAID6.");
return 0;
}
6 years, 5 months
master - raid: ignore --stripes/--stripesize on takeover
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4a3884245d02bcdad41...
Commit: 4a3884245d02bcdad41e4dd99f9201721c60158f
Parent: b765288bf242bbbdc93ef2f76ae4d3f7bdeb5868
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Thu Oct 26 17:16:23 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Thu Oct 26 17:16:23 2017 +0200
raid: ignore --stripes/--stripesize on takeover
Converting from one raid level to another, no changes
of stripes or stripesize can be requested because those
are subject to reshaping. I.e. the process requires to
takeover first and secondly request raid algorithm,
stripe or stripesize changes.
Ignore any related changes display warninngs
and proceed with the takeover.
Without this patch, a takeover requesting
stripesize change causes data corruption!
---
lib/metadata/raid_manip.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index f065a4c..f48169e 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -502,7 +502,6 @@ static int _reset_flags_passed_to_kernel(struct logical_volume *lv, int *flags_r
return 0;
if (slv->status & LV_RESHAPE_DELTA_DISKS_MINUS) {
- *flags_reset = 1;
slv->status |= LV_REMOVE_AFTER_RESHAPE;
seg_metalv(seg, s)->status |= LV_REMOVE_AFTER_RESHAPE;
}
@@ -6293,6 +6292,17 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
r = 0;
}
+ /* Can't reshape stripes or stripe size when performing a takeover! */
+ if (!_is_same_level(seg_from->segtype, *segtype_to)) {
+ if (stripes && stripes != _data_rimages_count(seg_from, seg_from->area_count))
+ log_warn("WARNING: ignoring --stripes option on takeover of %s (reshape afterwards).",
+ display_lvname(seg_from->lv));
+
+ if (!seg_is_raid1(seg_from) && new_stripe_size_supplied)
+ log_warn("WARNING: ignoring --stripesize option on takeover of %s (reshape afterwards).",
+ display_lvname(seg_from->lv));
+ }
+
if (r &&
!yes &&
strcmp((*segtype_to)->name, SEG_TYPE_NAME_MIRROR) && /* "mirror" is prompted for later */
@@ -6465,11 +6475,20 @@ int lv_raid_convert(struct logical_volume *lv,
return 0;
}
+ /*
+ * stripes and stripe_size can only be changed via reshape, not in a takeover!
+ *
+ * Ignore any of them here unless a takeover from raid1 to
+ * raid4/5 is requested when stripe size may be defined.
+ */
+ stripes = _data_rimages_count(seg, seg->area_count);
+ stripe_size = seg_is_raid1(seg) ? stripe_size : seg->stripe_size;
+
takeover_fn = _get_takeover_fn(first_seg(lv), new_segtype, new_image_count);
/* Exit without doing activation checks if the combination isn't possible */
if (_takeover_not_possible(takeover_fn))
- return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, new_stripes, stripe_size,
+ return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, stripes, stripe_size,
region_size, allocate_pvs);
/*
@@ -6498,7 +6517,7 @@ int lv_raid_convert(struct logical_volume *lv,
lv->status &= ~LV_RESHAPE;
- return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, new_stripes, stripe_size,
+ return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, stripes, stripe_size,
region_size, allocate_pvs);
}
6 years, 5 months
master - tests: better clustering support
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b765288bf242bbbdc93...
Commit: b765288bf242bbbdc93ef2f76ae4d3f7bdeb5868
Parent: 1e80ec892615f9da897da518cb3c55261d2bd51e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 26 14:00:44 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 26 14:04:58 2017 +0200
tests: better clustering support
Use exclusive activation for snapshot conversion since we can only
convert exclusively active volumes.
---
test/shell/lvconvert-snapshot-cache.sh | 2 +-
test/shell/lvconvert-snapshot-mirror.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-snapshot-cache.sh b/test/shell/lvconvert-snapshot-cache.sh
index 396f431..0d9c9c6 100644
--- a/test/shell/lvconvert-snapshot-cache.sh
+++ b/test/shell/lvconvert-snapshot-cache.sh
@@ -28,7 +28,7 @@ vgchange -s 16k $vg
lvcreate -L1 -n cow $vg
# Thin and snapshot conversion
-lvcreate -L1 -n ch $vg
+lvcreate -aey -L1 -n ch $vg
lvcreate -H -L1 -n cpool $vg/ch
# Cannot create snapshot of cpool
diff --git a/test/shell/lvconvert-snapshot-mirror.sh b/test/shell/lvconvert-snapshot-mirror.sh
index 8af9e25..01c19d9 100644
--- a/test/shell/lvconvert-snapshot-mirror.sh
+++ b/test/shell/lvconvert-snapshot-mirror.sh
@@ -24,7 +24,7 @@ vgchange -s 16k $vg
lvcreate -L1 -n cow $vg
# Mirror and snapshot conversion
-lvcreate --type mirror -L1 -m1 -n mir $vg
+lvcreate -aye --type mirror -L1 -m1 -n mir $vg
# Cannot create snapshot of mirror leg
not lvcreate -s -L1 $vg/mir_mimage_0 2>&1 | tee err
6 years, 5 months