backport some bugfix patches from upstream
(cherry picked from commit 21096c26e621dfa9d4ca0cafc016a2f1c7df6bf0)
This commit is contained in:
parent
b2459875a4
commit
8f174c9a91
49
0015-devices-file-move-clean-up-after-command-is-run.patch
Normal file
49
0015-devices-file-move-clean-up-after-command-is-run.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 9dfa6f38793f6b5f7de2a4148ab2f7790e3c39da Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Fri, 27 May 2022 12:38:43 -0500
|
||||
Subject: [PATCH] devices file: move clean up after command is run
|
||||
|
||||
devices_file_exit wasn't being called between lvm_shell
|
||||
commands, so the file lock wouldn't be released.
|
||||
|
||||
Conflict: toolcontext.c context adaptation
|
||||
---
|
||||
lib/commands/toolcontext.c | 2 --
|
||||
tools/lvmcmdline.c | 1 +
|
||||
2 files changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||
index 4cb81bf94..2666d7b42 100644
|
||||
--- a/lib/commands/toolcontext.c
|
||||
+++ b/lib/commands/toolcontext.c
|
||||
@@ -1921,7 +1921,6 @@ int refresh_toolcontext(struct cmd_context *cmd)
|
||||
_destroy_segtypes(&cmd->segtypes);
|
||||
_destroy_formats(cmd, &cmd->formats);
|
||||
|
||||
- devices_file_exit(cmd);
|
||||
if (!dev_cache_exit())
|
||||
stack;
|
||||
_destroy_dev_types(cmd);
|
||||
@@ -2053,7 +2052,6 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
set_global_cmdline(NULL);
|
||||
if (cmd->mem)
|
||||
dm_pool_destroy(cmd->mem);
|
||||
- devices_file_exit(cmd);
|
||||
dev_cache_exit();
|
||||
_destroy_dev_types(cmd);
|
||||
_destroy_tags(cmd);
|
||||
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
||||
index 1e3547ed7..b052d698f 100644
|
||||
--- a/tools/lvmcmdline.c
|
||||
+++ b/tools/lvmcmdline.c
|
||||
@@ -3292,6 +3292,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
hints_exit(cmd);
|
||||
lvmcache_destroy(cmd, 1, 1);
|
||||
label_scan_destroy(cmd);
|
||||
+ devices_file_exit(cmd);
|
||||
|
||||
if ((config_string_cft = remove_config_tree_by_source(cmd, CONFIG_STRING)))
|
||||
dm_config_destroy(config_string_cft);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
From 7ec0726ce331a4dc1ab5dc5e1b9ae503e5d758da Mon Sep 17 00:00:00 2001
|
||||
From: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Thu, 5 May 2022 11:02:32 +0200
|
||||
Subject: [PATCH] toollib: fix segfault when handling selection with historical
|
||||
LVs
|
||||
|
||||
When processing historical LVs inside process_each_lv_in_vg for
|
||||
selection, we need to use dummy "_historical_lv" for select_match_lv.
|
||||
|
||||
This is because a historical LV is not an actual LV, but only a tiny
|
||||
representation with subset of original properties that we recorded
|
||||
(name, uuid...).
|
||||
|
||||
To use the same processing functions we use for full-fledged non-historical
|
||||
LVs, we need to use the prefilled "_historical_lv" structure which has all
|
||||
the other missing properties hard-coded.
|
||||
|
||||
Conflict: remove WHAT_NEW
|
||||
---
|
||||
tools/toollib.c | 7 ++++---
|
||||
1 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index 545407c2f..d77092d89 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -3215,13 +3215,14 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
||||
process_lv = 1;
|
||||
}
|
||||
|
||||
- process_lv = process_lv && select_match_lv(cmd, handle, vg, lvl->lv) && _select_matches(handle);
|
||||
+ _historical_lv.this_glv = glvl->glv;
|
||||
+ _historical_lv.name = glvl->glv->historical->name;
|
||||
+
|
||||
+ process_lv = process_lv && select_match_lv(cmd, handle, vg, &_historical_lv) && _select_matches(handle);
|
||||
|
||||
if (!process_lv)
|
||||
continue;
|
||||
|
||||
- _historical_lv.this_glv = glvl->glv;
|
||||
- _historical_lv.name = glvl->glv->historical->name;
|
||||
log_very_verbose("Processing historical LV %s in VG %s.", glvl->glv->historical->name, vg->name);
|
||||
|
||||
ret = process_single_lv(cmd, &_historical_lv, handle);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
46
0017-Move-nolocking-warning-to-man-page.patch
Normal file
46
0017-Move-nolocking-warning-to-man-page.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From f1578b4a5d0bf49ab2b07c86c982cfa5aaa60a84 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Fri, 25 Mar 2022 15:43:53 -0500
|
||||
Subject: [PATCH] Move nolocking warning to man page
|
||||
|
||||
It's more logical to warn about --nolocking in the man page
|
||||
before it's used rather than after it's used and too late.
|
||||
Also, warnings are usually for things the user may not know.
|
||||
---
|
||||
tools/args.h | 3 ++-
|
||||
tools/lvmcmdline.c | 5 +----
|
||||
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tools/args.h b/tools/args.h
|
||||
index 56669645d..ecb650234 100644
|
||||
--- a/tools/args.h
|
||||
+++ b/tools/args.h
|
||||
@@ -499,7 +499,8 @@ arg(nohistory_ARG, '\0', "nohistory", 0, 0, 0,
|
||||
"metadata/record_lvs_history is enabled.\n")
|
||||
|
||||
arg(nolocking_ARG, '\0', "nolocking", 0, 0, 0,
|
||||
- "Disable locking.\n")
|
||||
+ "Disable locking. Use with caution, concurrent commands may produce\n")
|
||||
+ "incorrect results.\n")
|
||||
|
||||
arg(norestorefile_ARG, '\0', "norestorefile", 0, 0, 0,
|
||||
"In conjunction with --uuid, this allows a uuid to be specified\n"
|
||||
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
||||
index 241c6df18..1e3547ed7 100644
|
||||
--- a/tools/lvmcmdline.c
|
||||
+++ b/tools/lvmcmdline.c
|
||||
@@ -3267,10 +3267,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (arg_is_set(cmd, readonly_ARG))
|
||||
readonly = 1;
|
||||
|
||||
- if (cmd->nolocking) {
|
||||
- if (!_cmd_no_meta_proc(cmd))
|
||||
- log_warn("WARNING: File locking is disabled.");
|
||||
- } else {
|
||||
+ if (!cmd->nolocking) {
|
||||
if (!init_locking(cmd, sysinit, readonly, cmd->ignorelockingfailure)) {
|
||||
ret = ECMD_FAILED;
|
||||
goto_out;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
26
0018-fix-args-entry-for-nolocking.patch
Normal file
26
0018-fix-args-entry-for-nolocking.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 86a0a652a9eedd932c7428ed82656f3fd40d13f8 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Fri, 25 Mar 2022 17:25:29 -0500
|
||||
Subject: [PATCH 002/270] fix args entry for nolocking
|
||||
|
||||
typo in previous commit
|
||||
---
|
||||
tools/args.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/args.h b/tools/args.h
|
||||
index ecb650234..03fe24556 100644
|
||||
--- a/tools/args.h
|
||||
+++ b/tools/args.h
|
||||
@@ -499,7 +499,7 @@ arg(nohistory_ARG, '\0', "nohistory", 0, 0, 0,
|
||||
"metadata/record_lvs_history is enabled.\n")
|
||||
|
||||
arg(nolocking_ARG, '\0', "nolocking", 0, 0, 0,
|
||||
- "Disable locking. Use with caution, concurrent commands may produce\n")
|
||||
+ "Disable locking. Use with caution, concurrent commands may produce\n"
|
||||
"incorrect results.\n")
|
||||
|
||||
arg(norestorefile_ARG, '\0', "norestorefile", 0, 0, 0,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
28
0019-dmsetup-check-also-for-ouf-of-range-value.patch
Normal file
28
0019-dmsetup-check-also-for-ouf-of-range-value.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 718e38d5faf3a3ca23690d2f4203df1df65eba77 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Thu, 18 Aug 2022 13:56:03 +0200
|
||||
Subject: [PATCH 094/270] dmsetup: check also for ouf of range value
|
||||
|
||||
Check errno result from strtoull().
|
||||
---
|
||||
libdm/dm-tools/dmsetup.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
|
||||
index 8502d9adc..42eeead68 100644
|
||||
--- a/libdm/dm-tools/dmsetup.c
|
||||
+++ b/libdm/dm-tools/dmsetup.c
|
||||
@@ -5106,8 +5106,9 @@ static int _size_from_string(char *argptr, uint64_t *size, const char *name)
|
||||
if (!argptr)
|
||||
return_0;
|
||||
|
||||
+ errno = 0;
|
||||
*size = strtoull(argptr, &endptr, 10);
|
||||
- if (endptr == argptr) {
|
||||
+ if (errno || endptr == argptr) {
|
||||
*size = 0;
|
||||
log_error("Invalid %s argument: \"%s\"",
|
||||
name, (*argptr) ? argptr : "");
|
||||
--
|
||||
2.33.0
|
||||
|
||||
93
0020-toollib-do-not-process-just-created-historical-LV.patch
Normal file
93
0020-toollib-do-not-process-just-created-historical-LV.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 908555459f0abbcda687882439589209528e1dc0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Wed, 12 Oct 2022 14:41:58 +0200
|
||||
Subject: [PATCH 225/270] toollib: do not process just created historical LV
|
||||
|
||||
When executing process_each_lv_in_vg, we process live LVs first and
|
||||
after that, we process any historical LVs. In case we have just removed
|
||||
an LV, which also means we have just made it "historical" and so it
|
||||
appears as fresh item in vg->historical_lvs list, we have to skip it
|
||||
when we get to processing historical LVs inside the same process_each_lv_in_vg
|
||||
call.
|
||||
|
||||
The simplest approach here, without introducing another LV list, is to
|
||||
simply mark such historical LVs as "fresh" directly in struct
|
||||
historical_logical_volume when we have just removed the original LV
|
||||
and created the historical LV for it. Then, we just need to check the
|
||||
flag when processing historical LVs and skip it if it is "fresh".
|
||||
|
||||
When we read historical LVs out of metadata, they are marked as
|
||||
"not fresh" and so they can be processed as usual.
|
||||
|
||||
This was mainly an issue in conjuction with -S|--select use:
|
||||
|
||||
# lvmconfig --type diff
|
||||
metadata {
|
||||
record_lvs_history=1
|
||||
}
|
||||
|
||||
(In this example, a thin pool with lvol1 thin LV and lvol2 and lvol3 snapshots.)
|
||||
|
||||
# lvs -H vg -o name,pool_lv,full_ancestors,full_descendants
|
||||
LV Pool FAncestors FDescendants
|
||||
lvol1 pool lvol2,lvol3
|
||||
lvol2 pool lvol1 lvol3
|
||||
lvol3 pool lvol2,lvol1
|
||||
pool
|
||||
|
||||
# lvremove -S 'name=lvol2'
|
||||
Logical volume "lvol2" successfully removed.
|
||||
Historical logical volume "lvol2" successfully removed.
|
||||
|
||||
...here, the historical LV lvol2 should not have been removed because
|
||||
we have just removed its original non-historical lvol2 and the fresh
|
||||
historical lvol2 must not be included in the same processing spree.
|
||||
|
||||
Conflict: WHATS_NEW
|
||||
---
|
||||
lib/metadata/lv.h | 1 +
|
||||
lib/metadata/pool_manip.c | 1 +
|
||||
tools/toollib.c | 3 +++
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
|
||||
index 304ee2f7d..e591a9510 100644
|
||||
--- a/lib/metadata/lv.h
|
||||
+++ b/lib/metadata/lv.h
|
||||
@@ -93,6 +93,7 @@ struct historical_logical_volume {
|
||||
struct dm_list indirect_glvs; /* list of struct generic_logical_volume */
|
||||
unsigned checked:1; /* set if this historical LV has been checked for validity */
|
||||
unsigned valid:1; /* historical LV is valid if there's at least one live LV among ancestors */
|
||||
+ unsigned fresh:1; /* historical LV has just been created (the original LV just removed) */
|
||||
};
|
||||
|
||||
struct generic_logical_volume {
|
||||
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
|
||||
index a6bfc2deb..559b07ba8 100644
|
||||
--- a/lib/metadata/pool_manip.c
|
||||
+++ b/lib/metadata/pool_manip.c
|
||||
@@ -169,6 +169,7 @@ static struct glv_list *_init_historical_glvl(struct dm_pool *mem, struct lv_seg
|
||||
hlv->name = seg->lv->name;
|
||||
hlv->vg = seg->lv->vg;
|
||||
hlv->timestamp = seg->lv->timestamp;
|
||||
+ hlv->fresh = 1;
|
||||
dm_list_init(&hlv->indirect_glvs);
|
||||
|
||||
glvl->glv->is_historical = 1;
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index e45afb6ee..5305e811b 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -3206,6 +3206,9 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
||||
goto_out;
|
||||
}
|
||||
|
||||
+ if (glvl->glv->historical->fresh)
|
||||
+ continue;
|
||||
+
|
||||
process_lv = process_all;
|
||||
|
||||
if (lvargs_supplied &&
|
||||
--
|
||||
2.33.0
|
||||
|
||||
176
0021-pvscan-match-device-arg-to-filter-symlink.patch
Normal file
176
0021-pvscan-match-device-arg-to-filter-symlink.patch
Normal file
@ -0,0 +1,176 @@
|
||||
From d12baba1a9bfe2d82537b20bc768758d84b263b6 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Mon, 29 Nov 2021 17:13:44 -0600
|
||||
Subject: [PATCH] pvscan: match device arg to filter symlink
|
||||
|
||||
This fixes an issue related to the optimization in
|
||||
"pvscan: only add device args to dev cache"
|
||||
|
||||
If the devices file is not used, and the lvm.conf filter
|
||||
accepts devices via symlink names, then those devices won't
|
||||
be accepted by pvscan for autoactivation. To resolve this,
|
||||
recognize when the filter contains symlinks and disable the
|
||||
optimization. When the optimization is disabled, a full
|
||||
dev_cache_scan is performed, and symlinks are associated
|
||||
with the device names passed to pvscan. filter-regex
|
||||
will accept a device if symlinks to that device are accepted.
|
||||
|
||||
Conflict: context adaptation in test/shell/udev-pvscan-vgchange.sh
|
||||
---
|
||||
test/shell/udev-pvscan-vgchange.sh | 52 ++++++++++++++++++++++++
|
||||
tools/pvscan.c | 63 ++++++++++++++++++++++++++++++
|
||||
2 files changed, 115 insertions(+)
|
||||
|
||||
diff --git a/test/shell/udev-pvscan-vgchange.sh b/test/shell/udev-pvscan-vgchange.sh
|
||||
index a82bf8876..a209dc048 100644
|
||||
--- a/test/shell/udev-pvscan-vgchange.sh
|
||||
+++ b/test/shell/udev-pvscan-vgchange.sh
|
||||
@@ -382,8 +382,13 @@ BDEVMD=$(basename "$mddev")
|
||||
lvcreate -l1 -an -n $lv1 $vg9
|
||||
lvcreate -l1 -an -n $lv2 $vg9
|
||||
|
||||
+mdadm --stop "$mddev"
|
||||
+systemctl stop lvm-activate-$vg9 || true
|
||||
_clear_online_files
|
||||
+mdadm --assemble "$mddev" "$dev1" "$dev2"
|
||||
|
||||
+# this trigger might be redundant because the mdadm --assemble
|
||||
+# probably triggers an add uevent
|
||||
udevadm trigger --settle -c add /sys/block/$BDEVMD
|
||||
|
||||
wait_lvm_activate $vg9
|
||||
@@ -401,3 +406,50 @@ mdadm --stop "$mddev"
|
||||
aux udev_wait
|
||||
wipe_all
|
||||
|
||||
+# no devices file, filter with symlink of PV
|
||||
+# the pvscan needs to look at all dev names to
|
||||
+# match the symlink in the filter with the
|
||||
+# dev name (or major minor) passed to pvscan.
|
||||
+# This test doesn't really belong in this file
|
||||
+# because it's not testing lvm-activate.
|
||||
+
|
||||
+aux lvmconf 'devices/use_devicesfile = 0'
|
||||
+_clear_online_files
|
||||
+rm "$DF"
|
||||
+vgcreate $vg10 "$dev1"
|
||||
+lvcreate -l1 -an -n $lv1 $vg10 "$dev1"
|
||||
+
|
||||
+PVID1=$(pvs "$dev1" --noheading -o uuid | tr -d - | awk '{print $1}')
|
||||
+# PVID with dashes
|
||||
+OPVID1=`pvs "$dev1" --noheading -o uuid | awk '{print $1}'`
|
||||
+
|
||||
+udevadm trigger --settle -c add /sys/block/$BDEV1
|
||||
+
|
||||
+# uevent from the trigger should create this symlink
|
||||
+ls /dev/disk/by-id/lvm-pv-uuid-$OPVID1
|
||||
+
|
||||
+vgchange -an $vg10
|
||||
+systemctl stop lvm-activate-$vg10
|
||||
+_clear_online_files
|
||||
+
|
||||
+aux lvmconf "devices/filter = [ \"a|/dev/disk/by-id/lvm-pv-uuid-$OPVID1|\", \"r|.*|\" ]"
|
||||
+aux lvmconf 'devices/global_filter = [ "a|.*|" ]'
|
||||
+
|
||||
+pvscan --cache -aay "$dev1"
|
||||
+
|
||||
+check lv_field $vg10/$lv1 lv_active "active"
|
||||
+
|
||||
+vgchange -an $vg10
|
||||
+_clear_online_files
|
||||
+
|
||||
+aux lvmconf 'devices/filter = [ "a|lvm-pv-uuid|", "r|.*|" ]'
|
||||
+aux lvmconf 'devices/global_filter = [ "a|.*|" ]'
|
||||
+
|
||||
+pvscan --cache -aay "$dev1"
|
||||
+
|
||||
+check lv_field $vg10/$lv1 lv_active "active"
|
||||
+
|
||||
+vgchange -an $vg10
|
||||
+vgremove -y $vg10
|
||||
+wipe_all
|
||||
+
|
||||
diff --git a/tools/pvscan.c b/tools/pvscan.c
|
||||
index d360ec87f..0c25fb542 100644
|
||||
--- a/tools/pvscan.c
|
||||
+++ b/tools/pvscan.c
|
||||
@@ -1127,6 +1127,45 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * The optimization in which only the pvscan arg devname is added to dev-cache
|
||||
+ * does not work if there's an lvm.conf filter containing symlinks to the dev
|
||||
+ * like /dev/disk/by-id/lvm-pv-uuid-xyz entries. A full dev_cache_scan will
|
||||
+ * associate the symlinks with the system dev name passed to pvscan, which lets
|
||||
+ * filter-regex match the devname with the symlink name in the filter.
|
||||
+ */
|
||||
+static int _filter_uses_symlinks(struct cmd_context *cmd, int filter_cfg)
|
||||
+{
|
||||
+ const struct dm_config_node *cn;
|
||||
+ const struct dm_config_value *cv;
|
||||
+
|
||||
+ if ((cn = find_config_tree_array(cmd, filter_cfg, NULL))) {
|
||||
+ for (cv = cn->v; cv; cv = cv->next) {
|
||||
+ if (cv->type != DM_CFG_STRING)
|
||||
+ continue;
|
||||
+ if (!cv->v.str)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!strncmp(cv->v.str, "/dev/disk/", 10))
|
||||
+ return 1;
|
||||
+ if (!strncmp(cv->v.str, "/dev/mapper/", 12))
|
||||
+ return 1;
|
||||
+ if (cv->v.str[0] == '/')
|
||||
+ continue;
|
||||
+
|
||||
+ /* In case /dev/disk/by was omitted */
|
||||
+ if (strstr(cv->v.str, "lvm-pv-uuid"))
|
||||
+ return 1;
|
||||
+ if (strstr(cv->v.str, "dm-uuid"))
|
||||
+ return 1;
|
||||
+ if (strstr(cv->v.str, "wwn-"))
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
struct pvscan_arg {
|
||||
struct dm_list list;
|
||||
const char *devname;
|
||||
@@ -1191,6 +1230,30 @@ static int _get_args_devs(struct cmd_context *cmd, struct dm_list *pvscan_args,
|
||||
struct pvscan_arg *arg;
|
||||
struct device_list *devl;
|
||||
|
||||
+ /*
|
||||
+ * If no devices file is used, and lvm.conf filter is set to
|
||||
+ * accept /dev/disk/by-id/lvm-pv-uuid-xyz or another symlink,
|
||||
+ * but pvscan --cache is passed devname or major:minor, so
|
||||
+ * pvscan needs to match its arg device to the filter symlink.
|
||||
+ * setup_dev_in_dev_cache() adds /dev/sda2 to dev-cache which
|
||||
+ * does not match a symlink to /dev/sda2, so we need a full
|
||||
+ * dev_cache_scan that will associate all symlinks to sda2,
|
||||
+ * which allows filter-regex to work. This case could be
|
||||
+ * optimized if needed by adding dev-cache entries for each
|
||||
+ * filter "a" entry (filter symlink patterns would still need
|
||||
+ * a full dev_cache_scan.)
|
||||
+ * (When no devices file is used and 69-dm-lvm.rules is
|
||||
+ * used which calls pvscan directly, symlinks may not
|
||||
+ * have been created by other rules when pvscan runs, so
|
||||
+ * the full dev_cache_scan may still not find them.)
|
||||
+ */
|
||||
+ if (!cmd->enable_devices_file && !cmd->enable_devices_list &&
|
||||
+ (_filter_uses_symlinks(cmd, devices_filter_CFG) ||
|
||||
+ _filter_uses_symlinks(cmd, devices_global_filter_CFG))) {
|
||||
+ log_print_pvscan(cmd, "finding all devices for filter symlinks.");
|
||||
+ dev_cache_scan(cmd);
|
||||
+ }
|
||||
+
|
||||
/* pass NULL filter when getting devs from dev-cache, filtering is done separately */
|
||||
|
||||
/* in common usage, no dev will be found for a devno */
|
||||
--
|
||||
2.33.0
|
||||
|
||||
59
0022-pvscan-fix-filter-symlink-checks.patch
Normal file
59
0022-pvscan-fix-filter-symlink-checks.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 05d9a013516f23e27b04b6933705c6ae45f9f5b2 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 1 Dec 2021 13:40:09 -0600
|
||||
Subject: [PATCH] pvscan: fix filter symlink checks
|
||||
|
||||
Fixes commit "pvscan: match device arg to filter symlink"
|
||||
which failed to account for the fact that filter entries
|
||||
are not just path names but include "a" or "r", etc.
|
||||
|
||||
Conflict: context adaptation in tools/pvscan.c
|
||||
---
|
||||
tools/pvscan.c | 18 +++++++++++-------
|
||||
1 file changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tools/pvscan.c b/tools/pvscan.c
|
||||
index 429b5e676..dcf183a46 100644
|
||||
--- a/tools/pvscan.c
|
||||
+++ b/tools/pvscan.c
|
||||
@@ -1138,6 +1138,7 @@ static int _filter_uses_symlinks(struct cmd_context *cmd, int filter_cfg)
|
||||
{
|
||||
const struct dm_config_node *cn;
|
||||
const struct dm_config_value *cv;
|
||||
+ const char *fname;
|
||||
|
||||
if ((cn = find_config_tree_array(cmd, filter_cfg, NULL))) {
|
||||
for (cv = cn->v; cv; cv = cv->next) {
|
||||
@@ -836,19 +837,22 @@ static int _filter_uses_symlinks(struct cmd_context *cmd, int filter_cfg)
|
||||
if (!cv->v.str)
|
||||
continue;
|
||||
|
||||
- if (!strncmp(cv->v.str, "/dev/disk/", 10))
|
||||
+ fname = cv->v.str;
|
||||
+
|
||||
+ if (fname[0] != 'a')
|
||||
+ continue;
|
||||
+
|
||||
+ if (strstr(fname, "/dev/disk/"))
|
||||
return 1;
|
||||
- if (!strncmp(cv->v.str, "/dev/mapper/", 12))
|
||||
+ if (strstr(fname, "/dev/mapper/"))
|
||||
return 1;
|
||||
- if (cv->v.str[0] == '/')
|
||||
- continue;
|
||||
|
||||
/* In case /dev/disk/by was omitted */
|
||||
- if (strstr(cv->v.str, "lvm-pv-uuid"))
|
||||
+ if (strstr(fname, "lvm-pv-uuid"))
|
||||
return 1;
|
||||
- if (strstr(cv->v.str, "dm-uuid"))
|
||||
+ if (strstr(fname, "dm-uuid"))
|
||||
return 1;
|
||||
- if (strstr(cv->v.str, "wwn-"))
|
||||
+ if (strstr(fname, "wwn-"))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
13
lvm2.spec
13
lvm2.spec
@ -43,7 +43,7 @@
|
||||
|
||||
Name: lvm2
|
||||
Version: 2.03.14
|
||||
Release: 6
|
||||
Release: 7
|
||||
Epoch: 8
|
||||
Summary: Tools for logical volume management
|
||||
License: GPLv2+ and LGPLv2.1 and BSD
|
||||
@ -63,6 +63,14 @@ Patch11: 0011-bugfix-lvm2-fix-the-reuse-of-va_list.patch
|
||||
Patch12: 0012-13-dm-disk.rules-check-DM_NAME-before-create-symlink.patch
|
||||
Patch13: 0013-dev_name-determine-whether-the-dev-aliases-linked-li.patch
|
||||
Patch14: 0014-lvm-code-reduce-cyclomatic-complexity.patch
|
||||
Patch15: 0015-devices-file-move-clean-up-after-command-is-run.patch
|
||||
Patch16: 0016-toollib-fix-segfault-when-handling-selection-with-hi.patch
|
||||
Patch17: 0017-Move-nolocking-warning-to-man-page.patch
|
||||
Patch18: 0018-fix-args-entry-for-nolocking.patch
|
||||
Patch19: 0019-dmsetup-check-also-for-ouf-of-range-value.patch
|
||||
Patch20: 0020-toollib-do-not-process-just-created-historical-LV.patch
|
||||
Patch21: 0021-pvscan-match-device-arg-to-filter-symlink.patch
|
||||
Patch22: 0022-pvscan-fix-filter-symlink-checks.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -489,6 +497,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Dec 17 2022 volcanodragon<linfeilong@huawei.com> - 8:2.03.14-7
|
||||
- backport some bugfix patches from upstream
|
||||
|
||||
* Mon Nov 7 2022 wuzx<wuzx1226@qq.com> - 8:2.03.14-6
|
||||
- Add sw64 architecture
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user