From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - pvscan: fix filter symlink checks
Date: Wed, 1 Dec 2021 19:42:48 +0000 (GMT) [thread overview]
Message-ID: <20211201194248.012C7385840C@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=05d9a013516f23e27b04b6933705c6ae45f9f5b2
Commit: 05d9a013516f23e27b04b6933705c6ae45f9f5b2
Parent: d5402e55f6b9d3a5f407502ce5c7a8a5bfd12243
Author: David Teigland <teigland@redhat.com>
AuthorDate: Wed Dec 1 13:40:09 2021 -0600
Committer: David Teigland <teigland@redhat.com>
CommitterDate: Wed Dec 1 13:42:32 2021 -0600
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.
---
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
@@ -828,6 +828,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;
}
}
reply other threads:[~2021-12-01 19:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211201194248.012C7385840C@sourceware.org \
--to=teigland@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.