stable-2.02 - lvmlockd: do not allow mirror LV to be activated shared
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3669c33af4279c93c8a...
Commit: 3669c33af4279c93c8a9104de9501ba9cf6a2745
Parent: e2ae1f2d715d64c508d8f978a62d37a95c5d682d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 15:06:37 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 15:06:37 2019 -0500
lvmlockd: do not allow mirror LV to be activated shared
This reverts 518a8e8cfbb672c2bf5e3455f1fe7cd8d94eb5b0
"lvmlockd: activate mirror LVs in shared mode with cmirrord"
because while activating a mirror LV with cmirrord worked,
changes to the active cmirror did not work.
---
WHATS_NEW | 1 +
lib/commands/toolcontext.h | 1 -
lib/locking/lvmlockd.c | 38 +-------------------------------------
lib/metadata/mirror.c | 12 ------------
lib/mirror/mirrored.c | 9 ---------
man/lvmlockd.8_main | 2 +-
6 files changed, 3 insertions(+), 60 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1b68e47..106661f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.186 -
================================
+ Prevent shared active mirror LVs with lvmlockd.
Version 2.02.185 - 13th May 2019
================================
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index da5d582..485dca9 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -163,7 +163,6 @@ struct cmd_context {
unsigned lockd_vg_rescan:1;
unsigned lockd_vg_default_sh:1;
unsigned lockd_vg_enforce_sh:1;
- unsigned lockd_lv_sh:1;
unsigned vg_notify:1;
unsigned lv_notify:1;
unsigned pv_notify:1;
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 788b62b..1160126 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2076,15 +2076,6 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- /*
- * This is a hack for mirror LVs which need to know at a very low level
- * which lock mode the LV is being activated with so that it can pick
- * a mirror log type during activation. Do not use this for anything
- * else.
- */
- if (mode && !strcmp(mode, "sh"))
- cmd->lockd_lv_sh = 1;
-
if (!mode)
mode = "ex";
@@ -2209,31 +2200,6 @@ static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
}
/*
- * Only the combination of dlm + corosync + cmirrord allows
- * mirror LVs to be activated in shared mode on multiple nodes.
- */
-static int _lockd_lv_mirror(struct cmd_context *cmd, struct logical_volume *lv,
- const char *def_mode, uint32_t flags)
-{
- if (!strcmp(lv->vg->lock_type, "sanlock"))
- flags |= LDLV_MODE_NO_SH;
-
- else if (!strcmp(lv->vg->lock_type, "dlm") && def_mode && !strcmp(def_mode, "sh")) {
-#ifdef CMIRRORD_PIDFILE
- if (!cmirrord_is_running()) {
- log_error("cmirrord must be running to activate an LV in shared mode.");
- return 0;
- }
-#else
- flags |= LDLV_MODE_NO_SH;
-#endif
- }
-
- return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
- lv->lock_args, def_mode, flags);
-}
-
-/*
* If the VG has no lock_type, then this function can return immediately.
* The LV itself may have no lock (NULL lv->lock_args), but the lock request
* may be directed to another lock, e.g. the pool LV lock in _lockd_lv_thin.
@@ -2286,14 +2252,12 @@ int lockd_lv(struct cmd_context *cmd, struct logical_volume *lv,
*/
if (lv_is_external_origin(lv) ||
lv_is_thin_type(lv) ||
+ lv_is_mirror_type(lv) ||
lv_is_raid_type(lv) ||
lv_is_cache_type(lv)) {
flags |= LDLV_MODE_NO_SH;
}
- if (lv_is_mirror_type(lv))
- return _lockd_lv_mirror(cmd, lv, def_mode, flags);
-
return lockd_lv_name(cmd, lv->vg, lv->name, &lv->lvid.id[1],
lv->lock_args, def_mode, flags);
}
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index b1dcaa0..cd8ce1e 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -2104,18 +2104,6 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
}
}
- if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "dlm") && cmd->lockd_lv_sh) {
- if (!cluster_mirror_is_available(cmd)) {
- log_error("Shared cluster mirrors are not available.");
- return 0;
- }
-
- if (log_count > 1) {
- log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
- return 0;
- }
- }
-
/* For corelog mirror, activation code depends on
* the global mirror_in_sync status. As we are adding
* a new mirror, it should be set as 'out-of-sync'
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 7c5c0a6..606bcf0 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -285,15 +285,6 @@ static int _add_log(struct dm_pool *mem, struct lv_segment *seg,
if (!laopts->exclusive && vg_is_clustered(seg->lv->vg))
clustered = 1;
- else if (seg->lv->vg->lock_type && !strcmp(seg->lv->vg->lock_type, "dlm")) {
- /*
- * If shared lock was used due to -asy, then we set clustered
- * to use a clustered mirror log with cmirrod.
- */
- if (seg->lv->vg->cmd->lockd_lv_sh)
- clustered = 1;
- }
-
if (seg->log_lv) {
/* If disk log, use its UUID */
if (!(log_dlid = build_dm_uuid(mem, seg->log_lv, NULL))) {
diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main
index cfb45b2..3f0e3ed 100644
--- a/man/lvmlockd.8_main
+++ b/man/lvmlockd.8_main
@@ -545,7 +545,7 @@ report an error and fail.
The shared mode is intended for a multi-host/cluster application or
file system.
LV types that cannot be used concurrently
-from multiple hosts include thin, cache, raid, and snapshot.
+from multiple hosts include thin, cache, raid, mirror, and snapshot.
.IP \fBn\fP
The command deactivates the LV. After deactivating the LV, the command
4 years, 10 months
master - tests: fsadm-crypt.sh update mkfs parameter
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=78afe75b08c01e70d52...
Commit: 78afe75b08c01e70d52e42b62acf0d6eab7874dc
Parent: cf3f46392940391d8a27d969125d7ca9c4c5bebc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 14:46:01 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 14:46:01 2019 -0500
tests: fsadm-crypt.sh update mkfs parameter
mkfs.xfs was rejecting previously working value
---
test/shell/fsadm-crypt.sh | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/shell/fsadm-crypt.sh b/test/shell/fsadm-crypt.sh
index 68fed95..9377e89 100644
--- a/test/shell/fsadm-crypt.sh
+++ b/test/shell/fsadm-crypt.sh
@@ -268,7 +268,7 @@ test_ext3_small_shrink() {
}
test_xfs_resize() {
- mkfs.xfs -l internal,size=1000b -f "$3"
+ mkfs.xfs -l internal,size=1536b -f "$3"
fsadm --lvresize resize $1 30M
# Fails - not enough space for 4M fs
@@ -283,7 +283,7 @@ test_xfs_resize() {
}
test_xfs_small_shrink() {
- mkfs.xfs -l internal,size=1000b -f "$3"
+ mkfs.xfs -l internal,size=1536b -f "$3"
not lvresize -L-1 -r $1
fscheck_xfs "$3"
@@ -347,7 +347,7 @@ test_ext3_inactive() {
test_xfs_inactive() {
crypt_open "$2" $PWD2 "$4"
- mkfs.xfs -l internal,size=1000b -f "$3"
+ mkfs.xfs -l internal,size=1536b -f "$3"
crypt_close "$4"
not fsadm --lvresize resize $1 30M
@@ -428,7 +428,7 @@ test_ext3_plain() {
}
test_xfs_plain() {
- mkfs.xfs -l internal,size=1000b -f "$3"
+ mkfs.xfs -l internal,size=1536b -f "$3"
not fsadm --lvresize resize $1 30M
not lvresize -L+10M -r $1
@@ -494,7 +494,7 @@ test_ext3_detached() {
}
test_xfs_detached() {
- mkfs.xfs -l internal,size=1000b -f "$3"
+ mkfs.xfs -l internal,size=1536b -f "$3"
not fsadm --lvresize resize $1 30M
not lvresize -L+10M -r $1
4 years, 10 months
master - tests: pvscan-autoactivate.sh switch system_id_source
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf3f46392940391d8a2...
Commit: cf3f46392940391d8a27d969125d7ca9c4c5bebc
Parent: 99ca06ca4662ac43c09fb423bb26451ae5171d86
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 14:37:55 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 14:37:55 2019 -0500
tests: pvscan-autoactivate.sh switch system_id_source
to machineid instead of uname which would break if
the test system had no proper uname set.
---
test/shell/pvscan-autoactivate.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/pvscan-autoactivate.sh b/test/shell/pvscan-autoactivate.sh
index 6ed35db..362a4ff 100644
--- a/test/shell/pvscan-autoactivate.sh
+++ b/test/shell/pvscan-autoactivate.sh
@@ -134,7 +134,7 @@ not ls "$RUNDIR/lvm/pvs_online/$PVID3"
# pvscan cache ignores pv in a foreign vg
-aux lvmconf "global/system_id_source = uname"
+aux lvmconf "global/system_id_source = machineid"
_clear_online_files
4 years, 10 months
master - tests: hints check if strace exists
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=99ca06ca4662ac43c09...
Commit: 99ca06ca4662ac43c09fb423bb26451ae5171d86
Parent: dc1e12dcd423cf912489e1ed380fa6eb1a049f2e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 14:23:01 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 14:24:57 2019 -0500
tests: hints check if strace exists
avoid test failure if test system does not
have strace
---
test/shell/hints.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/shell/hints.sh b/test/shell/hints.sh
index 31628b0..019912e 100644
--- a/test/shell/hints.sh
+++ b/test/shell/hints.sh
@@ -53,12 +53,15 @@ grep -v -E "$dev1|$dev2" $HINTS > tmptest
not grep scan: tmptest
# test that 'pvs' submits only two reads, one for each PV in hints
+
+if [ -e "/usr/bin/strace" ]; then
strace -e io_submit pvs 2>&1|tee tmptest
test "$(grep io_submit tmptest | wc -l)" -eq 2
# test that 'pvs -a' submits six reads, one for each device
strace -e io_submit pvs -a 2>&1|tee tmptest
test "$(grep io_submit tmptest | wc -l)" -eq 6
+fi
#
# vg2 uses dev3,dev4
4 years, 10 months
master - scan: expand and update label scan comments
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dc1e12dcd423cf91248...
Commit: dc1e12dcd423cf912489e1ed380fa6eb1a049f2e
Parent: 60bf9c9f331fb0282b1ceca57148aad54cb943a0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 12:02:40 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 12:02:40 2019 -0500
scan: expand and update label scan comments
---
lib/label/label.c | 89 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 61 insertions(+), 28 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index b999f87..43b05a2 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -847,8 +847,11 @@ static void _free_hints(struct dm_list *hints)
}
/*
- * Scan and cache lvm data from all devices on the system.
- * The cache should be empty/reset before calling this.
+ * Scan devices on the system to discover which are LVM devices.
+ * Info about the LVM devices (PVs) is saved in lvmcache in a
+ * basic/summary form (info/vginfo structs). The vg_read phase
+ * uses this summary info to know which PVs to look at for
+ * processing a given VG.
*/
int label_scan(struct cmd_context *cmd)
@@ -860,7 +863,8 @@ int label_scan(struct cmd_context *cmd)
struct device_list *devl, *devl2;
struct device *dev;
uint64_t max_metadata_size_bytes;
- int newhints = 0;
+ int using_hints;
+ int create_hints = 0; /* NEWHINTS_NONE */
log_debug_devs("Finding devices to scan");
@@ -869,20 +873,37 @@ int label_scan(struct cmd_context *cmd)
dm_list_init(&hints_list);
/*
- * Iterate through all the devices in dev-cache (block devs that appear
- * under /dev that could possibly hold a PV and are not excluded by
- * filters). Read each to see if it's an lvm device, and if so
- * populate lvmcache with some basic info about the device and the VG
- * on it. This info will be used by the vg_read() phase of the
- * command.
+ * dev_cache_scan() creates a list of devices on the system
+ * (saved in in dev-cache) which we can iterate through to
+ * search for LVM devs. The dev cache list either comes from
+ * looking at dev nodes under /dev, or from udev.
*/
dev_cache_scan();
+ /*
+ * Set up the iterator that is needed to step through each device in
+ * dev cache.
+ */
if (!(iter = dev_iter_create(cmd->filter, 0))) {
log_error("Scanning failed to get devices.");
return 0;
}
+ log_debug_devs("Filtering devices to scan");
+
+ /*
+ * Iterate through all devices in dev cache and apply filters
+ * to exclude devs that we do not need to scan. Those devs
+ * that pass the filters are returned by the iterator and
+ * saved in a list of devs that we will proceed to scan to
+ * check if they are LVM devs. IOW this loop is the
+ * application of filters (those that do not require reading
+ * the devs) to the list of all devices. It does that because
+ * the 'cmd->filter' is used above when setting up the iterator.
+ * Unfortunately, it's not obvious that this is what's happening
+ * here. filters that require reading the device are not applied
+ * here, but in process_block(), see DEV_FILTER_AFTER_SCAN.
+ */
while ((dev = dev_iter_get(cmd, iter))) {
if (!(devl = zalloc(sizeof(*devl))))
continue;
@@ -901,13 +922,12 @@ int label_scan(struct cmd_context *cmd)
/*
* When md devices exist that use the old superblock at the
* end of the device, then in order to detect and filter out
- * the component devices of those md devs, we need to enable
- * the full md filter which scans both the start and the end
- * of every device. This doubles the amount of scanning i/o,
- * which we want to avoid. FIXME: it may not be worth the
- * cost of double i/o just to avoid displaying md component
- * devs in 'pvs', which is a pretty harmless effect from a
- * pretty uncommon situation.
+ * the component devices of those md devs, we enable the full
+ * md filter which scans both the start and the end of every
+ * device. This doubles the amount of scanning i/o, which we
+ * want to avoid. FIXME: this forces start+end scanning of
+ * every device, but it would be more efficient to limit the
+ * end scan only to PVs.
*/
if (dev_is_md_with_end_superblock(cmd->dev_types, dev))
cmd->use_full_md_check = 1;
@@ -920,7 +940,10 @@ int label_scan(struct cmd_context *cmd)
}
/*
- * In some common cases we can avoid scanning all devices.
+ * In some common cases we can avoid scanning all devices
+ * by using hints which tell us which devices are PVs, which
+ * are the only devices we actually need to scan. Without
+ * hints we need to scan all devs to find which are PVs.
*
* TODO: if the command is using hints and a single vgname
* arg, we can also take the vg lock here, prior to scanning.
@@ -930,10 +953,12 @@ int label_scan(struct cmd_context *cmd)
* able to avoid rescan in vg_read, but locking early would
* apply to more cases.)
*/
- if (!get_hints(cmd, &hints_list, &newhints, &all_devs, &scan_devs)) {
+ if (!get_hints(cmd, &hints_list, &create_hints, &all_devs, &scan_devs)) {
dm_list_splice(&scan_devs, &all_devs);
dm_list_init(&hints_list);
- }
+ using_hints = 0;
+ } else
+ using_hints = 1;
log_debug("Will scan %d devices skip %d", dm_list_size(&scan_devs), dm_list_size(&all_devs));
@@ -979,17 +1004,18 @@ int label_scan(struct cmd_context *cmd)
dm_list_init(&cmd->hints);
- if (!dm_list_empty(&hints_list)) {
+ /*
+ * If we're using hints to limit which devs we scanned, verify
+ * that those hints were valid, and if not we need to scan the
+ * rest of the devs.
+ */
+ if (using_hints) {
if (!validate_hints(cmd, &hints_list)) {
- /*
- * We scanned a subset of all devices based on hints.
- * With the results from the scan we may decide that
- * the hints are not valid, so scan all others.
- */
log_debug("Will scan %d remaining devices", dm_list_size(&all_devs));
_scan_list(cmd, cmd->filter, &all_devs, NULL);
_free_hints(&hints_list);
- newhints = 0;
+ using_hints = 0;
+ create_hints = 0;
} else {
/* The hints may be used by another device iteration. */
dm_list_splice(&cmd->hints, &hints_list);
@@ -1006,8 +1032,15 @@ int label_scan(struct cmd_context *cmd)
free(devl);
}
- if (newhints)
- write_hint_file(cmd, newhints);
+ /*
+ * If hints were not available/usable, then we scanned all devs,
+ * and we now know which are PVs. Save this list of PVs we've
+ * identified as hints for the next command to use.
+ * (create_hints variable has NEWHINTS_X value which indicates
+ * the reason for creating the new hints.)
+ */
+ if (create_hints)
+ write_hint_file(cmd, create_hints);
return 1;
}
4 years, 10 months
master - hints: exclude md components
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=60bf9c9f331fb0282b1...
Commit: 60bf9c9f331fb0282b1ceca57148aad54cb943a0
Parent: 6422b9ddc5c46968e2bef6ced12cd38e0b44c49d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 11:58:01 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 11:58:01 2019 -0500
hints: exclude md components
In some cases md components could be included in
the hints, so add a check to hint creation to make
sure they are excluded.
---
lib/device/dev-md.c | 12 +++++++++---
lib/device/dev-type.c | 1 +
lib/device/device.h | 1 +
lib/label/hints.c | 5 +++++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index ab93206..261f3f1 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -216,14 +216,20 @@ int dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
if (!full) {
if (!ret || (ret == -EAGAIN)) {
if (udev_dev_is_md_component(dev))
- return 1;
+ ret = 1;
}
}
+ if (ret && (ret != -EAGAIN))
+ dev->flags |= DEV_IS_MD_COMPONENT;
return ret;
}
- if (dev->ext.src == DEV_EXT_UDEV)
- return _udev_dev_is_md_component(dev);
+ if (dev->ext.src == DEV_EXT_UDEV) {
+ ret = _udev_dev_is_md_component(dev);
+ if (ret && (ret != -EAGAIN))
+ dev->flags |= DEV_IS_MD_COMPONENT;
+ return ret;
+ }
log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
"using external device info source %s", dev_ext_name(dev));
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index f0faa3d..73e55ca 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -1180,6 +1180,7 @@ int udev_dev_is_md_component(struct device *dev)
if (value && !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID)) {
log_debug("Device %s is md raid component based on blkid variable in udev db (%s=\"%s\").",
dev_name(dev), DEV_EXT_UDEV_BLKID_TYPE, value);
+ dev->flags |= DEV_IS_MD_COMPONENT;
ret = 1;
goto out;
}
diff --git a/lib/device/device.h b/lib/device/device.h
index afeee7f..395405a 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -36,6 +36,7 @@
#define DEV_FILTER_OUT_SCAN 0x00004000 /* filtered out during label scan */
#define DEV_BCACHE_WRITE 0x00008000 /* bcache_fd is open with RDWR */
#define DEV_SCAN_FOUND_LABEL 0x00010000 /* label scan read dev and found label */
+#define DEV_IS_MD_COMPONENT 0x00020000 /* device is an md component */
/*
* Support for external device info.
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 00bfbe3..72dc91e 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -901,6 +901,11 @@ int write_hint_file(struct cmd_context *cmd, int newhints)
if (!(dev->flags & DEV_SCAN_FOUND_LABEL))
continue;
+ if (dev->flags & DEV_IS_MD_COMPONENT) {
+ log_debug("exclude md component from hints %s", dev_name(dev));
+ continue;
+ }
+
/*
* No vgname will be found here for a PV with no mdas,
* in which case the vgname hint will be incomplete.
4 years, 10 months
master - move the setting of use_full_md_check flag
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6422b9ddc5c46968e2b...
Commit: 6422b9ddc5c46968e2bef6ced12cd38e0b44c49d
Parent: 19ef399ea781c2c74d0bc8de92f673648d190016
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 11:51:58 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 11:51:58 2019 -0500
move the setting of use_full_md_check flag
from each command to one location in command init.
No functional change.
---
tools/lvmcmdline.c | 18 ++++++++++++++++++
tools/pvcreate.c | 3 ---
tools/vgcreate.c | 3 ---
tools/vgextend.c | 3 ---
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 0422613..79de85b 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2766,6 +2766,22 @@ static int _init_lvmlockd(struct cmd_context *cmd)
return 1;
}
+static void _init_md_checks(struct cmd_context *cmd)
+{
+ /*
+ * use_full_md_check can also be set later.
+ * These commands are chosen to always perform
+ * a full md component check because they initialize
+ * a new device that could be an md component,
+ * and they are not run frequently during normal
+ * operation.
+ */
+ if (!strcmp(cmd->name, "pvcreate") ||
+ !strcmp(cmd->name, "vgcreate") ||
+ !strcmp(cmd->name, "vgextend"))
+ cmd->use_full_md_check = 1;
+}
+
static int _cmd_no_meta_proc(struct cmd_context *cmd)
{
return cmd->cname->flags & NO_METADATA_PROCESSING;
@@ -2979,6 +2995,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
}
}
+ _init_md_checks(cmd);
+
if (!_cmd_no_meta_proc(cmd) && !_init_lvmlockd(cmd)) {
ret = ECMD_FAILED;
goto_out;
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index 5b59a79..29ae0fa 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -136,9 +136,6 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
pp.pv_count = argc;
pp.pv_names = argv;
- /* Check for old md signatures at the end of devices. */
- cmd->use_full_md_check = 1;
-
/* Needed to change the set of orphan PVs. */
if (!lock_global(cmd, "ex"))
return_ECMD_FAILED;
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index 626cf15..6640b8e 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -63,9 +63,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
clear_hint_file(cmd);
- /* Check for old md signatures at the end of devices. */
- cmd->use_full_md_check = 1;
-
/*
* Check if the VG name already exists. This should be done before
* creating PVs on any of the devices.
diff --git a/tools/vgextend.c b/tools/vgextend.c
index 785be3f..e50a818 100644
--- a/tools/vgextend.c
+++ b/tools/vgextend.c
@@ -154,9 +154,6 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
/* pvcreate within vgextend cannot be forced. */
pp->force = 0;
- /* Check for old md signatures at the end of devices. */
- cmd->use_full_md_check = 1;
-
if (!lock_global(cmd, "ex"))
return_ECMD_FAILED;
4 years, 10 months
master - devs: rename dev_is_md dev_is_md_component
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19ef399ea781c2c74d0...
Commit: 19ef399ea781c2c74d0bc8de92f673648d190016
Parent: 0c26aa13ca588fc552a2748aee5654866ce7cced
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 11:44:39 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 21 11:44:39 2019 -0500
devs: rename dev_is_md dev_is_md_component
The naming was confusing and misleading since
it it's testing if a device is an md component,
not an md device.
---
lib/device/dev-md.c | 27 ++++++++++++++++++++-------
lib/device/dev-type.c | 2 +-
lib/device/dev-type.h | 2 +-
lib/filters/filter-md.c | 2 +-
lib/format_text/import_vsn1.c | 2 +-
5 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 15e1280..ab93206 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -88,8 +88,21 @@ static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
return sb_offset;
}
+/*
+ * _udev_dev_is_md_component() only works if
+ * external_device_info_source="udev"
+ *
+ * but
+ *
+ * udev_dev_is_md_component() in dev-type.c only works if
+ * obtain_device_list_from_udev=1
+ *
+ * and neither of those config setting matches very well
+ * with what we're doing here.
+ */
+
#ifdef UDEV_SYNC_SUPPORT
-static int _udev_dev_is_md(struct device *dev)
+static int _udev_dev_is_md_component(struct device *dev)
{
const char *value;
struct dev_ext *ext;
@@ -103,7 +116,7 @@ static int _udev_dev_is_md(struct device *dev)
return !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID);
}
#else
-static int _udev_dev_is_md(struct device *dev)
+static int _udev_dev_is_md_component(struct device *dev)
{
return 0;
}
@@ -112,7 +125,7 @@ static int _udev_dev_is_md(struct device *dev)
/*
* Returns -1 on error
*/
-static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int full)
+static int _native_dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
{
md_minor_version_t minor;
uint64_t size, sb_offset;
@@ -188,7 +201,7 @@ out:
return ret;
}
-int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
+int dev_is_md_component(struct device *dev, uint64_t *offset_found, int full)
{
int ret;
@@ -198,7 +211,7 @@ int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
* information is not in udev db.
*/
if ((dev->ext.src == DEV_EXT_NONE) || offset_found) {
- ret = _native_dev_is_md(dev, offset_found, full);
+ ret = _native_dev_is_md_component(dev, offset_found, full);
if (!full) {
if (!ret || (ret == -EAGAIN)) {
@@ -210,7 +223,7 @@ int dev_is_md(struct device *dev, uint64_t *offset_found, int full)
}
if (dev->ext.src == DEV_EXT_UDEV)
- return _udev_dev_is_md(dev);
+ return _udev_dev_is_md_component(dev);
log_error(INTERNAL_ERROR "Missing hook for MD device recognition "
"using external device info source %s", dev_ext_name(dev));
@@ -439,7 +452,7 @@ int dev_is_md_with_end_superblock(struct dev_types *dt, struct device *dev)
#else
-int dev_is_md(struct device *dev __attribute__((unused)),
+int dev_is_md_component(struct device *dev __attribute__((unused)),
uint64_t *sb __attribute__((unused)))
{
return 0;
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index e9106a9..f0faa3d 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -866,7 +866,7 @@ static int _wipe_known_signatures_with_lvm(struct device *dev, const char *name,
wiped = &wiped_tmp;
*wiped = 0;
- if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, wiped, dev_is_md) ||
+ if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, wiped, dev_is_md_component) ||
!_wipe_signature(dev, "swap signature", name, 10, yes, force, wiped, dev_is_swap) ||
!_wipe_signature(dev, "LUKS signature", name, 8, yes, force, wiped, dev_is_luks))
return 0;
diff --git a/lib/device/dev-type.h b/lib/device/dev-type.h
index d349905..e090050 100644
--- a/lib/device/dev-type.h
+++ b/lib/device/dev-type.h
@@ -57,7 +57,7 @@ const char *dev_subsystem_name(struct dev_types *dt, struct device *dev);
int major_is_scsi_device(struct dev_types *dt, int major);
/* Signature/superblock recognition with position returned where found. */
-int dev_is_md(struct device *dev, uint64_t *sb, int full);
+int dev_is_md_component(struct device *dev, uint64_t *sb, int full);
int dev_is_swap(struct device *dev, uint64_t *signature, int full);
int dev_is_luks(struct device *dev, uint64_t *signature, int full);
int dasd_is_cdl_formatted(struct device *dev);
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index d6dd28c..28903be 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -93,7 +93,7 @@ static int _passes_md_filter(struct cmd_context *cmd, struct dev_filter *f __att
if (!md_filtering())
return 1;
- ret = dev_is_md(dev, NULL, cmd->use_full_md_check);
+ ret = dev_is_md_component(dev, NULL, cmd->use_full_md_check);
if (ret == -EAGAIN) {
/* let pass, call again after scan */
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 79c73ae..8dad8e9 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -298,7 +298,7 @@ static int _read_pv(struct format_instance *fid,
* see the PV size, and can finally compare it with the device size.
*/
if (pv->dev && (pv->size != pv->dev->size)) {
- if (dev_is_md(pv->dev, NULL, 1)) {
+ if (dev_is_md_component(pv->dev, NULL, 1)) {
log_warn("WARNING: device %s is an md component, ignoring PV.", dev_name(pv->dev));
return_0;
}
4 years, 10 months
v2_02_185 annotated tag has been created
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cb59c874e027b756d67...
Commit: cb59c874e027b756d67e9ab00c24336cd42ab2a1
Parent: 0000000000000000000000000000000000000000
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: 2019-05-13 07:51 +0000
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: 2019-05-13 07:51 +0000
annotated tag: v2_02_185 has been created
at cb59c874e027b756d67e9ab00c24336cd42ab2a1 (tag)
tagging 3aeff09bd7db18e4cb83c44b52eae0acac755201 (commit)
replaces v2_02_184
Release 2.02.185
Bug fix release.
Notable changes:
Use pselect in daemons to avoid race during shutdown causing hanging process.
Automatically grow _tmeta when thin data gets too big for the metadata volume.
Grow _pmspare when extending _tmeta.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJc2SKIAAoJELkRJDHlCQOf3DYP/A0CRyrHg/VQVc1jw/X2sl2r
AjnuulJH8cNaYumZdg1wdx00gGRKG5j90/3tUBpN1u06GPrKFon1YhOhW3GkFkh3
stWrWt5z7QyP2/TymU+KJt+s87WGPjGg28vx26SYGC4F0I3lnZGNA7GAj1+hgMhU
mWPlXRexPWI9BMwDZrhPNdvgL+WVKI6RNXS7RU9SOJg1f/v8bmBRanuP1MEs2dJz
zXLlKPCtBlbntS8Xe0jh5c9IYoFi5mYA0EC+1HlvYR6x/i5WNil0K7Bd97CUgviI
VJ6/onCJiJRkLEh4UyqDLLWa2xLQGkSmBZCZ9sKLv+a+8ERWQxQn/obd0HAL35I+
dS+7hQnqm9nUBCyr8LCVVx5IFnwLPBF+NtCeCndrRSPsooCQDAVnXVFceVudg/BL
MwLDkiXO6vBIV+jK551eJUdSfpl85g9sr6oHfD9k0qte7W1gTfi4gLqxqWAB3jNl
GsqwdCDGN80pABK2hqVRLZlwrUfW9igwFHGdV/gcFLAwkX0gneWgB2M50gQX/Ben
rt0hBlJV0Lr/Vs2fmKQHgNLoouq7WZfjha9DxuKDzmKo6DTJ4aZwrK71UAla3yWl
Z9xVndUBjrV0OR83Hd6i4VyWySf+nIP4W9BTBcNgHEV9jFH4LXSRf1VL/jfue5yf
uMn9LU6a33HCReKbBPqn
=+QG1
-----END PGP SIGNATURE-----
David Teigland (1):
devices: drop open error message
Heinz Mauelshagen (1):
lvconvert: can't create cachepool with RAID1 metadata SubLV
Marian Csontos (4):
post-release
bcache: Fix memory leak
Wiping require exclusive actvation
pre-release
Peter Rajnoha (2):
systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
systemd: put back DefaultDependencies=no for lvmpolld and lvmetad socket unit
Zdenek Kabelac (21):
configure: check for pselect
libdaemon: use pselect to avoid condition checking race
gcc: cleanup const warning
cache: support vgsplit
tests: check vgsplit works with cache
cleanup: missed string specifier
libdaemon: ensure threads are reaped before checking shutdown
thin: introduce estimate_thin_pool_metadata_size
thin: resize metadata with data
thin: fix maintenance of _pmspare
tests: check auto-growth of thin-pool meta
activation: synchronize before removing devices
lv_manip: insert remove layer skips pools
thin: select chunk size as power of 2
lv_manip: better work with PERCENT_VG modifier
tests: rounding for pools changed to power of 2
tests: extend
tests: update parm for new kernel
monitoring: fix monitoring change for cluster
metadata: allow reading metadata with invalid creation_time
tests: check accepting out-of-range creation_time
4 years, 10 months
stable-2.02 - post-release
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e2ae1f2d715d64c508d...
Commit: e2ae1f2d715d64c508d8f978a62d37a95c5d682d
Parent: 3aeff09bd7db18e4cb83c44b52eae0acac755201
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon May 13 09:57:57 2019 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon May 13 09:57:57 2019 +0200
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 583267e..f68edcf 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.185(2) (2019-05-13)
+2.02.186(2)-git (2019-05-13)
diff --git a/VERSION_DM b/VERSION_DM
index 8c4af2c..88c14ba 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.158 (2019-05-13)
+1.02.160-git (2019-05-13)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4e75c6a..1b68e47 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.186 -
+================================
+
Version 2.02.185 - 13th May 2019
================================
Fix change of monitoring in clustered volumes.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 7c74bfe..15e5b8b 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.160 -
+================================
+
Version 1.02.158 - 13th May 2019
================================
4 years, 10 months