diff options
author | David Teigland <teigland@redhat.com> | 2023-01-19 17:37:31 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2023-01-31 15:30:35 -0600 |
commit | 17a3585cbb55d9a15ced9775a18b50c53a50ee8e (patch) | |
tree | 6a4d9620ead498a87456174b494a810e67c78a67 /lib | |
parent | d9f8acb65a78c20ac806efaeb7a1e39208e1a443 (diff) | |
download | lvm2-17a3585cbb55d9a15ced9775a18b50c53a50ee8e.tar.gz |
pvscan: use alternate device names from DEVLINKS to check filter
pvscan --cache <dev> is called by our udev rule at a time when all
the symlinks for <dev> may not be created yet (by other udev rules.)
The regex filter in lvm.conf may refer to <dev> using a symlink name
that hasn't yet been created, which would cause <dev> to not match
the filter regex. The DEVLINKS env var, set by udev, contains all
the symlink names for <dev> that have been or will be created.
So, we add all these symlink names to dev->aliases, as if we had
found them in /dev. This allows <dev> to be recognized by a regex
filter containing a symlink for <dev>.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/commands/toolcontext.h | 1 | ||||
-rw-r--r-- | lib/filters/filter-regex.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 7f5fd12fc..4069b6116 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -207,6 +207,7 @@ struct cmd_context { unsigned udevoutput:1; unsigned online_vg_file_removed:1; unsigned disable_dm_devs:1; /* temporarily disable use of dm devs cache */ + unsigned filter_regex_set_preferred_name_disable:1; /* prevent dev_set_preferred_name */ /* * Devices and filtering. diff --git a/lib/filters/filter-regex.c b/lib/filters/filter-regex.c index 05c5b3f2d..d9ed0104c 100644 --- a/lib/filters/filter-regex.c +++ b/lib/filters/filter-regex.c @@ -179,7 +179,7 @@ static int _accept_p(struct cmd_context *cmd, struct dev_filter *f, struct devic if (m >= 0) { if (dm_bit(rf->accept, m)) { - if (!first) + if (!first && !cmd->filter_regex_set_preferred_name_disable) dev_set_preferred_name(sl, dev); return 1; |