Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=db98a6e3629aaf6bf42d0…
Commit: db98a6e3629aaf6bf42d0e840273b4328f930c89
Parent: 24bd35b4ce77a5111ee234f554ca139df4b7dd99
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 21 12:06:34 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Jun 7 13:27:16 2019 -0500
Additional MD component checking
If udev info is missing for a device, (which would indicate
if it's an MD component), then do an end-of-device read to
check if a PV is an MD component. (This is skipped when
using hints since we already know devs in hints are good.)
A new config setting md_component_checks can be used to
disable the additional end-of-device MD checks, or to
always enable end-of-device MD checks.
When both hints and udev info are disabled/unavailable,
the end of PVs will now be scanned by default. If md
devices with end-of-device superblocks are not being
used, the extra I/O overhead can be avoided by setting
md_component_checks="start".
---
lib/cache/lvmcache.c | 7 +++-
lib/commands/toolcontext.h | 2 +
lib/config/config_settings.h | 25 +++++++++++++-
lib/config/defaults.h | 2 +
lib/device/dev-md.c | 5 ++-
lib/device/dev-type.c | 5 ++-
lib/device/device.h | 1 +
lib/label/label.c | 27 +++++++++++++++
test/shell/lvm-on-md.sh | 75 +++++++++++++++++++++++++++++------------
tools/lvmcmdline.c | 55 ++++++++++++++++++++++++------
10 files changed, 166 insertions(+), 38 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 8a29bf4..b62e5e2 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -555,8 +555,11 @@ next:
*/
if (!(info = lvmcache_info_from_pvid(alt->dev->pvid, NULL, 0))) {
- /* This shouldn't happen */
- log_warn("WARNING: PV %s on duplicate device %s not found in cache.",
+ /*
+ * This will happen if a duplicate dev has been dropped already,
+ * e.g. it was found to be an md component.
+ */
+ log_debug("PVID %s on duplicate device %s not found in cache.",
alt->dev->pvid, dev_name(alt->dev));
goto next;
}
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 0ea2132..7d373ab 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -172,6 +172,7 @@ struct cmd_context {
unsigned pvscan_cache_single:1;
unsigned can_use_one_scan:1;
unsigned is_clvmd:1;
+ unsigned md_component_detection:1;
unsigned use_full_md_check:1;
unsigned is_activating:1;
unsigned enable_hints:1; /* hints are enabled for cmds in general */
@@ -184,6 +185,7 @@ struct cmd_context {
*/
struct dev_filter *filter;
struct dm_list hints;
+ const char *md_component_checks;
/*
* Configuration.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index efa86e7..e718dec 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -368,7 +368,30 @@ cfg(devices_multipath_component_detection_CFG, "multipath_component_detection",
"Ignore devices that are components of DM multipath devices.\n")
cfg(devices_md_component_detection_CFG, "md_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MD_COMPONENT_DETECTION, vsn(1, 0, 18), NULL, 0, NULL,
- "Ignore devices that are components of software RAID (md) devices.\n")
+ "Enable detection and exclusion of MD component devices.\n"
+ "An MD component device is a block device that MD uses as part\n"
+ "of a software RAID virtual device. When an LVM PV is created\n"
+ "on an MD device, LVM must only use the top level MD device as\n"
+ "the PV, and should ignore the underlying component devices.\n"
+ "In cases where the MD superblock is located at the end of the\n"
+ "component devices, it is more difficult for LVM to consistently\n"
+ "identify an MD component, see the md_component_checks setting.\n")
+
+cfg(devices_md_component_checks_CFG, "md_component_checks", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_MD_COMPONENT_CHECKS, vsn(2, 3, 2), NULL, 0, NULL,
+ "The checks LVM should use to detect MD component devices.\n"
+ "MD component devices are block devices used by MD software RAID.\n"
+ "#\n"
+ "Accepted values:\n"
+ " auto\n"
+ " LVM will skip scanning the end of devices when it has other\n"
+ " indications that the device is not an MD component.\n"
+ " start\n"
+ " LVM will only scan the start of devices for MD superblocks.\n"
+ " This does not incur extra I/O by LVM.\n"
+ " full\n"
+ " LVM will scan the start and end of devices for MD superblocks.\n"
+ " This requires an extra read at the end of devices.\n"
+ "#\n")
cfg(devices_fw_raid_component_detection_CFG, "fw_raid_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_FW_RAID_COMPONENT_DETECTION, vsn(2, 2, 112), NULL, 0, NULL,
"Ignore devices that are components of firmware RAID devices.\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index fac5b75..6a0d686 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -318,4 +318,6 @@
#define DEFAULT_IO_MEMORY_SIZE_KB 8192
+#define DEFAULT_MD_COMPONENT_CHECKS "auto"
+
#endif /* _LVM_DEFAULTS_H */
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 261f3f1..08143b7 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -110,14 +110,17 @@ static int _udev_dev_is_md_component(struct device *dev)
if (!(ext = dev_ext_get(dev)))
return_0;
- if (!(value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_TYPE)))
+ if (!(value = udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_TYPE))) {
+ dev->flags |= DEV_UDEV_INFO_MISSING;
return 0;
+ }
return !strcmp(value, DEV_EXT_UDEV_BLKID_TYPE_SW_RAID);
}
#else
static int _udev_dev_is_md_component(struct device *dev)
{
+ dev->flags |= DEV_UDEV_INFO_MISSING;
return 0;
}
#endif
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 73e55ca..4e35220 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -1170,8 +1170,10 @@ int udev_dev_is_md_component(struct device *dev)
const char *value;
int ret = 0;
- if (!obtain_device_list_from_udev())
+ if (!obtain_device_list_from_udev()) {
+ dev->flags |= DEV_UDEV_INFO_MISSING;
return 0;
+ }
if (!(udev_device = _udev_get_dev(dev)))
return 0;
@@ -1198,6 +1200,7 @@ int udev_dev_is_mpath_component(struct device *dev)
int udev_dev_is_md_component(struct device *dev)
{
+ dev->flags |= DEV_UDEV_INFO_MISSING;
return 0;
}
diff --git a/lib/device/device.h b/lib/device/device.h
index 395405a..30e1e79 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -37,6 +37,7 @@
#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 */
+#define DEV_UDEV_INFO_MISSING 0x00040000 /* we have no udev info for this device */
/*
* Support for external device info.
diff --git a/lib/label/label.c b/lib/label/label.c
index 10c1c4c..f6ba2d8 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1022,6 +1022,33 @@ int label_scan(struct cmd_context *cmd)
}
}
+ /*
+ * Stronger exclusion of md components that might have been
+ * misidentified as PVs due to having an end-of-device md superblock.
+ * If we're not using hints, and are not already doing a full md check
+ * on devs being scanned, then if udev info is missing for a PV, scan
+ * the end of the PV to verify it's not an md component. The full
+ * dev_is_md_component call will do new reads at the end of the dev.
+ */
+ if (cmd->md_component_detection && !cmd->use_full_md_check && !using_hints &&
+ !strcmp(cmd->md_component_checks, "auto")) {
+ int once = 0;
+ dm_list_iterate_items(devl, &scan_devs) {
+ if (!(devl->dev->flags & DEV_SCAN_FOUND_LABEL))
+ continue;
+ if (!(devl->dev->flags & DEV_UDEV_INFO_MISSING))
+ continue;
+ if (!once++)
+ log_debug_devs("Scanning end of PVs with no udev info for MD components");
+
+ if (dev_is_md_component(devl->dev, NULL, 1)) {
+ log_debug_devs("Drop PV from MD component %s", dev_name(devl->dev));
+ devl->dev->flags &= ~DEV_SCAN_FOUND_LABEL;
+ lvmcache_del_dev(devl->dev);
+ }
+ }
+ }
+
dm_list_iterate_items_safe(devl, devl2, &all_devs) {
dm_list_del(&devl->list);
free(devl);
diff --git a/test/shell/lvm-on-md.sh b/test/shell/lvm-on-md.sh
index 41649be..22cbee8 100644
--- a/test/shell/lvm-on-md.sh
+++ b/test/shell/lvm-on-md.sh
@@ -31,6 +31,10 @@ test -f /proc/mdstat && grep -q raid1 /proc/mdstat || \
aux lvmconf 'devices/md_component_detection = 1'
+# This stops lvm from taking advantage of hints which
+# will have already excluded md components.
+aux lvmconf 'devices/hints = "none"'
+
# This stops lvm from asking udev if a dev is an md component.
# LVM will ask udev if a dev is an md component, but we don't
# want to rely on that ability in this test.
@@ -61,6 +65,10 @@ check lv_field $vg/$lv1 lv_active "active"
pvs "$mddev"
not pvs "$dev1"
not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
+
sleep 1
vgchange -an $vg
@@ -72,12 +80,14 @@ sleep 1
mdadm --stop "$mddev"
aux udev_wait
-# with md superblock 1.0 this pvs will report duplicates
-# for the two md legs since the md device itself is not
-# started
-pvs 2>&1 |tee out
-cat out
-grep "prefers device" out
+# The md components should still be detected and excluded.
+not pvs "$dev1"
+not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
+
+pvs -vvvv
# should not activate from the md legs
not vgchange -ay $vg
@@ -104,16 +114,20 @@ not grep "active" out
mdadm --assemble "$mddev" "$dev1" "$dev2"
aux udev_wait
-# Now that the md dev is online, pvs can see it and
-# ignore the two legs, so there's no duplicate warning
+# Now that the md dev is online, pvs can see it
+# and check for components even if
+# md_component_checks is "start" (which disables
+# most default end-of-device scans)
+aux lvmconf 'devices/md_component_checks = "start"'
-pvs 2>&1 |tee out
-cat out
-not grep "prefers device" out
+not pvs "$dev1"
+not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
-vgchange -ay $vg 2>&1 |tee out
-cat out
-not grep "prefers device" out
+
+vgchange -ay $vg
check lv_field $vg/$lv1 lv_active "active"
@@ -124,6 +138,9 @@ vgremove -f $vg
aux cleanup_md_dev
+# Put this setting back to the default
+aux lvmconf 'devices/md_component_checks = "auto"'
+
# create 2 disk MD raid0 array
# by default using metadata format 1.0 with data at the end of device
# When a raid0 md array is stopped, the components will not look like
@@ -149,6 +166,10 @@ check lv_field $vg/$lv1 lv_active "active"
pvs "$mddev"
not pvs "$dev1"
not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
+
sleep 1
vgchange -an $vg
@@ -160,7 +181,14 @@ sleep 1
mdadm --stop "$mddev"
aux udev_wait
-pvs 2>&1 |tee pvs.out
+# The md components should still be detected and excluded.
+not pvs "$dev1"
+not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
+
+pvs -vvvv
# should not activate from the md legs
not vgchange -ay $vg
@@ -187,16 +215,19 @@ not grep "active" out
mdadm --assemble "$mddev" "$dev1" "$dev2"
aux udev_wait
-# Now that the md dev is online, pvs can see it and
-# ignore the two legs, so there's no duplicate warning
+# Now that the md dev is online, pvs can see it
+# and check for components even if
+# md_component_checks is "start" (which disables
+# most default end-of-device scans)
+aux lvmconf 'devices/md_component_checks = "start"'
-pvs 2>&1 |tee out
-cat out
-not grep "prefers device" out
+not pvs "$dev1"
+not pvs "$dev2"
+pvs > out
+not grep "$dev1" out
+not grep "$dev2" out
vgchange -ay $vg 2>&1 |tee out
-cat out
-not grep "prefers device" out
check lv_field $vg/$lv1 lv_active "active"
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 79de85b..30f54e6 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2766,20 +2766,53 @@ static int _init_lvmlockd(struct cmd_context *cmd)
return 1;
}
+/*
+ * md_component_check full: always set use_full_md_check
+ * which causes filter-md to read the start+end of every
+ * device on the system (this could be optimized to only
+ * read the end of PVs.)
+ *
+ * md_component_check start: the end of devices will
+ * not generally be read to check for an md superblock
+ * (lvm may still scan for end-of-device md superblocks
+ * if it knows that some exists.)
+ *
+ * md_component_check auto: lvm will use some built-in
+ * heuristics to decide when it should scan the end of
+ * devices to look for md superblocks, e.g. commands
+ * like pvcreate that could clobber a component, or if
+ * udev info is not available and hints are not available.
+ */
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"))
+ const char *md_check;
+
+ cmd->md_component_detection = find_config_tree_bool(cmd, devices_md_component_detection_CFG, NULL);
+
+ md_check = find_config_tree_str(cmd, devices_md_component_checks_CFG, NULL);
+ if (!md_check)
+ cmd->md_component_checks = "auto";
+ else if (!strcmp(md_check, "auto") ||
+ !strcmp(md_check, "start") ||
+ !strcmp(md_check, "full"))
+ cmd->md_component_checks = md_check;
+ else {
+ log_warn("Ignoring unknown md_component_checks setting, using auto.");
+ cmd->md_component_checks = "auto";
+ }
+
+ if (!strcmp(cmd->md_component_checks, "full"))
cmd->use_full_md_check = 1;
+ else if (!strcmp(cmd->md_component_checks, "auto")) {
+ /* use_full_md_check can also be set later */
+ if (!strcmp(cmd->name, "pvcreate") ||
+ !strcmp(cmd->name, "vgcreate") ||
+ !strcmp(cmd->name, "vgextend"))
+ cmd->use_full_md_check = 1;
+ }
+
+ log_debug("Using md_component_checks %s use_full_md_check %d",
+ cmd->md_component_checks, cmd->use_full_md_check);
}
static int _cmd_no_meta_proc(struct cmd_context *cmd)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b97b215be1e22c0b621ee…
Commit: b97b215be1e22c0b621ee7092359ce827e0a0d82
Parent: 0000000000000000000000000000000000000000
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: 2019-06-07 15:25 +0000
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: 2019-06-07 15:25 +0000
annotated tag: v2_03_03 has been created
at b97b215be1e22c0b621ee7092359ce827e0a0d82 (tag)
tagging cb6277aa8a1f6d0dedf2082995b1673da1eb46f9 (commit)
replaces v2_03_01
Release 2.03.03
Bugfix and Feature Release
Notable changes:
- Add pvck --dump option to extract metadata from disk.
- New scan_lvs option, defaultingo to 0 so LVs are not scanned for PVs.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJc+oHSAAoJELkRJDHlCQOfYCgP+wcaZnBOECd/3mcsiMK9fu5u
zl/+akrGmJhWvvreLOXD5gP8ayLJpTx+8lx8FdHbp1Vt/0nFRrBixMv8TAlsw1Kk
5UcEx3HPv6p5lgKBOIFojgG40KrV48IazRUhF0B002lHuqxqi4ArzvXGaGn0hngR
zEg/948fgsfRDnvUlc2aUmKl2OKK1m5kCciwvihjDX7eL4xWa6ZfGf9ibeZ8JMqk
w10MJdDqs727TgDDCQtrnLpdLjrKf+QMx2O4Tl//73ygw45EQ4sCtwd4q9VF+RPB
+AxAuRiPGlEQc2BntLEru5Qr6cAR5ne8JphIlb2Hs7yuQgzttPBRwkaR+A00HahI
w6STjKFSlnWeY3QNfo/hMc+MSWoEt6tgBNqvckf3Hhny4Wu3L2tznlRRSnpThxKj
+Haq7DznR3i1Zm2gzfQ9IMNkdu673i0HWFj1fkt53pJBCcjkRmZw6ld4jmgQaR5g
nIfeAsDE9L2T6vn8x3TFCouw3bCX1PcgpNGyUT6b9zy/BkDjPdSLy0yeX3vhHiD4
Gt5htIKgo1Rk3n7vlOL8IN19vSbHUiNf1RAFPZjexznlbf3h9GM54PYpxmvXf1gF
gwG0L3C9iAec9r5kooQ2IzizFBTVw+OadthYKoTdWotYAWEaa/cJ7opgfJlikscb
W/c0EZGXVo63pqJOR7Px
=gYZd
-----END PGP SIGNATURE-----
Alasdair G Kergon (1):
dmsetup: Fix multi-line concise table parsing
Bryn M. Reeves (2):
libdm-stats: move no regions warning after dm_stats_list()
dmsetup: fix stats report command output
David Teigland (150):
lvmlockd: use new sanlock sector/align interface
lvmlockd: fix size/resizing of internal lvmlock LV for sanlock
lvmlockd: deactivate lvmlock LV in vgchange
lvmlockd: fix handling of sanlock release error
lvmlockd: use standard major minor functions
cache: add cache_mode_num_to_str
cache: factor settings text import export
cache: factor getting cache mode
cache: clean up segment line creation
cache: rename variable in _cache_display
cache: rename variable in _cache_add_target_line
cache: improve warning message about cached thin data
cache: improve error message about flush
cache: reorganize cache_set_policy
cache: factor report functions
cache: factor lvchange_cache
Allow dm-cache cache device to be standard LV
Add dm-writecache support
devices: reuse bcache fd when getting block size
tests: fix dd option in cache-single-options
tests: enable writeback in cache-single-options
tests: enable cachepolicy cleaner in cache-single-options
tests: add lvchange cachemode passthrough in cache-single-options
tests: specify m1 for raid1 in cache-single-types
man: lvmcache update
man: remove cluster references
man: remove clvmd man page
man lvmdump: remove clvm reference
man: remove lvmetad
man pvscan: replace lvmetad text
pvscan: background option is not used
man: pvscan updates
remove unused backgroundfork option
man: remove scattered lvmetad references
man: remove some clvmd references
lvm2-monitoring service shouldn't refer to lvmetad
scripts: remove lvmetad from makefile
io: use sync io if aio fails
bcache: sync io fixes
WHATS_NEW: sync io
writecache: set block_size using --cachesettings
pvscan systemd service for event based activation
blk_availability service drop lvmetad
Place the first PE at 1 MiB for all defaults
lvmlockctl: wait by default when stopping
lvmlockd: vgchange locktype with yes option
config settings: fix version 3.0.0
devs: use udev info to improve md component detection
pvscan: use correct dev filters
remove unused lvmetad filter
remove unused full filter
man lvmlockd: lvextend with gfs2
tests: lvm-on-md udev issues
lvmlockd: fix missing LV lock for lvconvert repair
unit test: use_lvmetad replaced by event_activation
Revert "lvconvert: use standard wiping code"
writecache: prompt before using an LV to hold cache
writecache: use wipe_lv to warn about specific signatures
add device hints to reduce scanning
WHATS_NEW: device hints
hints: fix hint flock when using lvm shell
lvmlockd: make lockstart wait for existing start
move init_use_aio
lvmlockd: fix make lockstart wait
hints: invalidate when pvscan --cache sees a new PV
vgscan: drop 'take a while' message
tests: use pvscan after enable_dev in process-each-duplicate-vgnames
apply obtain_device_list_from_udev to all libudev usage
hints: fix recreating hints from pvscan
config: change scan_lvs default to 0
tests: set scan_lvs=1 in tests that stack PVs on LVs
WHATS_NEW: scan_lvs default change
pvscan: fix autoactivation from concurrent pvscans
pvscan: autoactivate a VG once
WHATS_NEW: concurrent pvscan autoactivation
logging: add command[pid] and timestamp to file and verbose output
pvscan: fix hint recreation
logging: new config settings to specify debug fields
config: make hints setting commented
Use "cachevol" to refer to cache on a single LV
pvscan service: use StartLimitIntervalSec
logging: remove unused code
remove unused io functions
config: add new setting io_memory_size
io: warn when metadata size approaches io memory size
io: increase the default io memory from 4 to 8 MiB
WHATS_NEW: io_memory_size
pvscan: ignore online for unused PV
pvscan: ignore online for shared and foreign PVs
tests: check that pvscan --cache ignores certain PVs
config: improve scan_lvs description
pvscan: fix ignoring foreign PVs
warn about changes to an active lv with shared lock
lvextend: allow on LV active with a shared lock
lvextend: refresh shared LV remotely using dlm/corosync
lvextend: refresh shared LV using select option
lvextend: refresh shared LV with vgname as arg
lvresize: fix when compiled without lvmlockd
lvextend: refresh shared LV without using select
lvmlockd: do not allow mirror LV to be activated shared
man: updates to lvmlockd
pvscan: reorganize code
pvscan: for init only autoactivate vg for named dev
pvscan: remove initialization case
pvscan: don't print warning about lvmlockd not running
tests: update pvscan-autoactivate for init change
pvscan: print more reasons for ignoring devices
pvscan: ignore device with incorrect size
WHATS_NEW: add several recent changes
hints: fix case of error getting device size
hints: fix non-empty hints list when not using hints
tests: disable unworking pvscan case
pvscan: handle case of scanning PV without metadata last
wipe_lv: initially open LV in writable mode
locking: unify global lock for flock and lockd
remove retry for missed PVs in process_each_pv
hints: skip hint flock if nolocking option is set
pvscan: remove fixme comment that is fixed
pvcreate: call label scan prior to pvcreate_each_device
vgcreate: remove the lvmcache locking workaround
lvmcache: remove unused flag
remove unused string writecache
use memcpy for constant ondisk strings
lvmlockd: fix snprintf warnings
scan: remove comments about lvmetad
add md component check in vg_read based on size
pvscan: don't record PV online after error reading metadata
tests: expand lvm-on-md
pvs: remove unnecessary label scan
pvscan: fix segfault in recent commit
devs: rename dev_is_md dev_is_md_component
move the setting of use_full_md_check flag
hints: exclude md components
scan: expand and update label scan comments
tests: hints check if strace exists
tests: pvscan-autoactivate.sh switch system_id_source
tests: fsadm-crypt.sh update mkfs parameter
tests: pvscan-cache try to fix teardown problems
tests: fix error detection in lvconvert-raid-takeover.sh
tests: change mkfs usage in lvconvert raid tests
pvck: new dump option to extract metadata
WHATS_NEW: pvck --dump
separate code for setting devices from metadata parsing
tests: pvscan-cache more attempts to fix
tests: add debug to pvscan-cache deactivation
pvck: dump headers and metadata
pvck: dump metadata_all
tests: pvck-dump
pvck: use new dump routines for old output
tests: pvscan-autoactivate check for machine-id
Heinz Mauelshagen (5):
lvcreate/lvconvert: prohibit creation of/conversion to mirrored mirror logs
WHATS_NEW
raid: fix (de)activation of RaidLVs with visible SubLVs
man: document 's' RAID attribute bit
lvcreate/lvconvert: optionally reenable mirrored mirror log for testing purposes only
Marian Csontos (13):
post-release
build: Upse PYTHON_CONFIG env.variable when set
udev: 69-dm-lvm-metad.rules is still needed
dmeventd: Fix libdevmapper-event linking
tests: Remove unsupported mirrored mirrorlog
build: Remove reference to undefined @BUILD_LVMETAD@
build: Remove badly placed `@`
Revert "tests: Remove unsupported mirrored mirrorlog"
lvmlockd: Fix arguments when built without sanlock
cov: Close a FD on error
test: Restore testing of D-Bus API
test: Increase latency in pvmove-resume-multiseg
pre-release
Ming-Hung Tsai (1):
lvmanip: uninitialized members in struct pv_list (#10)
Peter Rajnoha (4):
scan: md metadata version 0.90 is at the end of disk
scripts: lvm2-activation-generator fix lvmconfig call
systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
systemd: put back DefaultDependencies=no for lvmpolld socket unit
Tony Asleson (13):
lvmdbusd: Dump blackbox newest first
lvmdbusd: Handle missing lv_attr table lookups
lvmdbusd: Update table lookup for health lv_attr
lvmdbusd: Update table lookup for state lv_attr
lvmdbusd: Exit daemon when unable to retrieve state
lvmdbusd: Handle exported VG(s)
tests/dbus: Re-enable nesting and pvcreate via symlink
lvmdbusd: Ensure all paths return value
lvmdbusd: LookUpByLvmId: Add doc for cb, cbe
lvmdbusd: Spelling correction
lvmdbusd: Correct object manager lookups
lvmdbusd: Handle duplicate VG names
lvmdbusd: Use UUID instead of name for VG rename
Zdenek Kabelac (206):
label: add stack trace for failing dev_set_last_byte
cov: remove uneeded code
cov: split check for type assignment
cov: explicit ignore if failures
cov: overflow before widen
cov: add missing check for dm_strncpy
cov: trace failing pthread_kill
cov: mark warning as expected one
cov: hide intentionaly ptr arithmetic report
cov: remove unused assigns
cov: avoid unsing unchecked label_scan_open
cleanup: move cast to det_t into MKDEV macro
debug: tracing fclose failure
debug: missing backtrace
pvscan: add error checking for write of online files
tests: add wait for udev
tests: fix shell quoting
activation: trimming string is expected
devicemapper: retry remove even for subLVs
configure: update
tests: keep results configurable
tests: updates
tests: futher test tunning
devicemapper: retry mirror leg deactivation
tests: add wait loop
libdm: do not add params for resume and remove
libdm: add DM_DEVICE_ARM_POLL
libdm: print params only for ioctls using them
libdm: add memory barrier
tests: secure data erase
tests: extend
tests: raise minsize of xfs
tests: drop unwanted backup
tests: makefile fixes
tests: still more libs needs
tests: correcting header file enclosure
tests: prefer internal header
tests: skip when gcore from gdb package is missing
tests: skip portion of test for lvmpolld
tests: create whole path with mkdir
tests: skip part of test
tests: update parm for new kernel
tests: speed-up testing full of lvm2 metadata
tests: generate slightly less volumes
sanlock: update headers
tests: missing copyright
tests: update required raid target
base: use calloc
makefiles: improve lcov generator
makefiles: updates for less verbosity
makefiles: avoid dependency calcs for base dir
makefiles: improving cleaning rules
makefiles: add missing srcdir
make: generate config update
make: generate man update
tests: add mising udev_wait
tests: use select with dmsetup
tests: requires at least 2 iterations
tests: updates
tests: reduce memory footprint
tests: drop use_lvmetad from unit test
configure: update
makefiles: ignore missing files
makefiles: clean unit-test
tests: extend sleep
rpm: install lvm2-pvscan again
device_mapper: fix incorrect dm_strncpy usage
device_mapper: optimize dm_pool_strndup
libdm: optimize dm_pool_strndup
device_mapper: move internal header to front
makefiles: avoid clustering out
makefiles: ensure test dir can run unit-test
gcc: avoid shadowing index
gcc: avoid shadowing activate_lv
gcc: avoid shadowing use_aio
gcc: ensure sector is initilized
libdm: use libdm header
headers: use configure.h as 1st. header
headers: use full path header instead of -I directive
makefiles: correct libdm dependency
makefiles: drop unneeded include path
makefiles: local headers first
makefiles: some leftovers from lvmetad
cleanup: some local headers first
debug: drop extra tracing
lvconvert: ensure proper init of pv_list
dmfilemapd: avoid linking with DL_LIBS
dmeventd: fix linking with libdevmapper
dmeventd: do not link internal libraries to plugins
lvm: drop usage of dl library
cmirror: link with libdm
makefiles: sort
makefiles: drop unneeded LIBS add
makefiles: quite install
makefiles: missing cleaning
makefiles: no longer used define
makefiles: allow to set LIBS in Makefiles
makefiles: dm-tools improve Makefile
makefiles: correcting login of makefile
makefile: fixes build for older system
makefiles: also fix build of unit test
dmeventd: resolve compilation of vdo status parsing
lib: move towards v2 version of VDO format
configure: avoid repeative inclusion of configure.h
lvmpolld: improve makefile deps
lvmlockd: fix error return code for _init_vg_sanlock
lvmlockd: use commonly used define NOTIFYDBUS_SUPPORT
lvmlockd: drop superfluous defines
scripts: avoid voiding write result
scripts: simplify including for generator
stats: fix error path when region is NULL
cleanup: missing copyright header
lvconvert: use standard wiping code
lvconvert: writecache fix return code
dmeventd: unlock lvm2 lock on error path
bcache: fix memory leak on error path
debug: drop some extra backtraces
debug: tracing close errors
mangenerator: check strdup was successfull
cov: ensure lock_type is not NULL
cov: looks like cut&paste error
cov: drop unneeded header file
cov: extent_size cannot be 0
Revert "lvmlockd: Fix arguments when built without sanlock"
stats: initilize regions to NULL
cov: fix memleak on error path
cleanup: use zalloc
debug: drop some unneeded backtraces
tests: testing mirrorred mirror log
tests: fix unit test
tests: indent
generators: avoid contacting syslog with generators
config: drop extra spaces
vdo: regenerate config
mirror: regenerate config
raid: man regenerated
vdo: fix archived metadata comment
vdo: update vdo profile
man: missed --zero option for thin-pool creation
man: initial man page for VDO support
man: document dD attrs for VDO lvs
dm: ensure migration_threshold is big enough
dm: migration_threshold for old linked tools
lv_manip: better work with PERCENT_VG modifier
vdo: introduce function for estimation of virtual size
vdo: estimate virtual size after resize
vdo: discard reduced area
vdo: size reduction requires VDO to be active
vdo: allow resize of VDO and VDO pool volumes
cleanup: better naming
vdo: man documenting resize
tests: update cache test
tests: aux fix testing for kvdo
tests: initial test for vdo resize
vdo: add simple wrapper for getting pool percentage
vdo: enable dmeventd resize
tests: vdo dmeventd resize
vdo: minor API cleanup
lv_manip: better work with PERCENT_VG modifier with lvresize
vdo: some formating updates
rpm: package lvmvdo man page
cache: select chunk size as power of 2
thin: select chunk size as power of 2
tests: rounding for pools changed to power of 2
lvconvert: pass force and yes options for vdo conversion
vdo: complete matching with thin syntax
vdo: document types vdo and vdo-pool
vdo: add some basic example
man: vdo regenerated
man: lvmvdo component activation description
cleanup: indent
gitignore: update
dev_manager: add dev_manager_remove_dm_major_minor
filter: enhance mpath detection
debug: use log_warn
thin: max thin
cache: support vgsplit
tests: check vgsplit works with cache
lv_manip: insert remove layer skips pools
vdo: enable caching for vdopool LV and vdo LV
activation: synchronize before removing devices
man: basic vdo stacking support
man: dmeventd vdo plugin
tests: vdo dmevent autoresize
tests: vdo caching tests
filter: fix mpath test
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
configure: check for pselect
libdaemon: use pselect to avoid condition checking race
cleanup: missed string specifier
clean: avoid cleaning iterator on error path
locking: validate locking mode
build: fix compilation without lvmlockd
cleanup: use unsigned type
tests: update resize value
tests: use luks1 for test
tests: drop call of wipefs
tests: split args
metadata: allow reading metadata with invalid creation_time
tests: check accepting out-of-range creation_time
cache: support no_discard_passdown
tests: automatically set scan_lvs when using extend_filter
tests: check no_discard_passdown
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c31e6b0acad339ec3cdc0…
Commit: c31e6b0acad339ec3cdc0c8d7e0e01f8d816ed10
Parent: cb7766bc1411c3350e79241122a974dac7fcc902
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jun 6 14:12:19 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 6 14:12:19 2019 -0500
lvmcache: remove unused_duplicate_devs list from cmd
Save the previous duplicate PVs in a global list instead
of a list on the cmd struct. dmeventd reuses the cmd struct
for multiple commands, and the list entries between commands
were being freed (apparently), causing a segfault in dmeventd
when it tried to use items in cmd->unused_duplicate_devs
that had been saved there by the previous command.
---
lib/cache/lvmcache.c | 16 +++++++++-------
lib/commands/toolcontext.c | 2 --
lib/commands/toolcontext.h | 1 -
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index ad40d4c..0ce5df0 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -100,6 +100,7 @@ static struct dm_hash_table *_saved_vg_hash = NULL;
static DM_LIST_INIT(_vginfos);
static DM_LIST_INIT(_found_duplicate_devs);
static DM_LIST_INIT(_unused_duplicate_devs);
+static DM_LIST_INIT(_prev_unused_duplicate_devs);
static int _scanning_in_progress = 0;
static int _has_scanned = 0;
static int _vgs_locked = 0;
@@ -118,6 +119,7 @@ int lvmcache_init(struct cmd_context *cmd)
dm_list_init(&_vginfos);
dm_list_init(&_found_duplicate_devs);
dm_list_init(&_unused_duplicate_devs);
+ dm_list_init(&_prev_unused_duplicate_devs);
if (!(_vgname_hash = dm_hash_create(128)))
return 0;
@@ -1152,14 +1154,14 @@ next:
if (!prev_unchosen1 && !prev_unchosen2) {
/*
- * The cmd list saves the unchosen preference across
+ * The prev list saves the unchosen preference across
* lvmcache_destroy. Sometimes a single command will
* fill lvmcache, destroy it, and refill it, and we
* want the same duplicate preference to be preserved
* in each instance of lvmcache for a single command.
*/
- prev_unchosen1 = _dev_in_device_list(dev1, &cmd->unused_duplicate_devs);
- prev_unchosen2 = _dev_in_device_list(dev2, &cmd->unused_duplicate_devs);
+ prev_unchosen1 = _dev_in_device_list(dev1, &_prev_unused_duplicate_devs);
+ prev_unchosen2 = _dev_in_device_list(dev2, &_prev_unused_duplicate_devs);
}
dev1_major = MAJOR(dev1->dev);
@@ -2575,8 +2577,8 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
dm_list_init(&_vginfos);
/*
- * Copy the current _unused_duplicate_devs into a cmd list before
- * destroying _unused_duplicate_devs.
+ * Move the current _unused_duplicate_devs to _prev_unused_duplicate_devs
+ * before destroying _unused_duplicate_devs.
*
* One command can init/populate/destroy lvmcache multiple times. Each
* time it will encounter duplicates and choose the preferrred devs.
@@ -2584,8 +2586,8 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
* the unpreferred devs here so that _choose_preferred_devs can use
* this to make the same choice each time.
*/
- dm_list_init(&cmd->unused_duplicate_devs);
- lvmcache_get_unused_duplicate_devs(cmd, &cmd->unused_duplicate_devs);
+ _destroy_duplicate_device_list(&_prev_unused_duplicate_devs);
+ dm_list_splice(&_prev_unused_duplicate_devs, &_unused_duplicate_devs);
_destroy_duplicate_device_list(&_unused_duplicate_devs);
_destroy_duplicate_device_list(&_found_duplicate_devs); /* should be empty anyway */
_found_duplicate_pvs = 0;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 25e8b87..38e382f 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1983,8 +1983,6 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
if (!init_lvmcache_orphans(cmd))
goto_out;
- dm_list_init(&cmd->unused_duplicate_devs);
-
if (!_init_segtypes(cmd))
goto_out;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 485dca9..6e262e8 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -231,7 +231,6 @@ struct cmd_context {
const char *report_list_item_separator;
const char *time_format;
unsigned rand_seed;
- struct dm_list unused_duplicate_devs; /* save preferences between lvmcache instances */
};
/*
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2bcd43c683eec3a07d4b7…
Commit: 2bcd43c683eec3a07d4b7833445856c9aad9963c
Parent: c315112a3b7d01e56cbd2ecb3d05f55d44a50e12
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Jun 7 10:12:52 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Jun 7 10:14:33 2019 -0500
lvmcache: remove unused_duplicate_devs list from cmd
Save the previous duplicate PVs in a global list instead
of a list on the cmd struct. dmeventd reuses the cmd struct
for multiple commands, and the list entries between commands
were being freed (apparently), causing a segfault in dmeventd
when it tried to use items in cmd->unused_duplicate_devs
that had been saved there by the previous command.
---
lib/cache/lvmcache.c | 16 +++++++++-------
lib/commands/toolcontext.c | 2 --
lib/commands/toolcontext.h | 1 -
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index a4037a5..8a29bf4 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -66,6 +66,7 @@ static struct dm_hash_table *_vgname_hash = NULL;
static DM_LIST_INIT(_vginfos);
static DM_LIST_INIT(_found_duplicate_devs);
static DM_LIST_INIT(_unused_duplicate_devs);
+static DM_LIST_INIT(_prev_unused_duplicate_devs);
static int _vgs_locked = 0;
static int _found_duplicate_pvs = 0; /* If we never see a duplicate PV we can skip checking for them later. */
static int _found_duplicate_vgnames = 0;
@@ -81,6 +82,7 @@ int lvmcache_init(struct cmd_context *cmd)
dm_list_init(&_vginfos);
dm_list_init(&_found_duplicate_devs);
dm_list_init(&_unused_duplicate_devs);
+ dm_list_init(&_prev_unused_duplicate_devs);
if (!(_vgname_hash = dm_hash_create(128)))
return 0;
@@ -581,14 +583,14 @@ next:
if (!prev_unchosen1 && !prev_unchosen2) {
/*
- * The cmd list saves the unchosen preference across
+ * The prev list saves the unchosen preference across
* lvmcache_destroy. Sometimes a single command will
* fill lvmcache, destroy it, and refill it, and we
* want the same duplicate preference to be preserved
* in each instance of lvmcache for a single command.
*/
- prev_unchosen1 = dev_in_device_list(dev1, &cmd->unused_duplicate_devs);
- prev_unchosen2 = dev_in_device_list(dev2, &cmd->unused_duplicate_devs);
+ prev_unchosen1 = dev_in_device_list(dev1, &_prev_unused_duplicate_devs);
+ prev_unchosen2 = dev_in_device_list(dev2, &_prev_unused_duplicate_devs);
}
dev1_major = MAJOR(dev1->dev);
@@ -1828,8 +1830,8 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
dm_list_init(&_vginfos);
/*
- * Copy the current _unused_duplicate_devs into a cmd list before
- * destroying _unused_duplicate_devs.
+ * Move the current _unused_duplicate_devs to _prev_unused_duplicate_devs
+ * before destroying _unused_duplicate_devs.
*
* One command can init/populate/destroy lvmcache multiple times. Each
* time it will encounter duplicates and choose the preferrred devs.
@@ -1837,8 +1839,8 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
* the unpreferred devs here so that _choose_preferred_devs can use
* this to make the same choice each time.
*/
- dm_list_init(&cmd->unused_duplicate_devs);
- lvmcache_get_unused_duplicate_devs(cmd, &cmd->unused_duplicate_devs);
+ _destroy_duplicate_device_list(&_prev_unused_duplicate_devs);
+ dm_list_splice(&_prev_unused_duplicate_devs, &_unused_duplicate_devs);
_destroy_duplicate_device_list(&_unused_duplicate_devs);
_destroy_duplicate_device_list(&_found_duplicate_devs); /* should be empty anyway */
_found_duplicate_pvs = 0;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 2642d23..1e03ea2 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1715,8 +1715,6 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
if (!init_lvmcache_orphans(cmd))
goto_out;
- dm_list_init(&cmd->unused_duplicate_devs);
-
if (!_init_segtypes(cmd))
goto_out;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index c9def87..0ea2132 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -234,7 +234,6 @@ struct cmd_context {
const char *report_list_item_separator;
const char *time_format;
unsigned rand_seed;
- struct dm_list unused_duplicate_devs; /* save preferences between lvmcache instances */
};
/*