diff options
author | David Teigland <teigland@redhat.com> | 2021-04-23 17:32:37 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2021-04-23 17:37:08 -0500 |
commit | 4dc5d4ac7e7a9457ccc46ff04796b347e58bf4da (patch) | |
tree | 1351a95314ea922a11e2f40677fc614fc206a457 /tools/pvscan.c | |
parent | fcbed26393f57d49daa7da73922b1a922f9523a2 (diff) | |
download | lvm2-4dc5d4ac7e7a9457ccc46ff04796b347e58bf4da.tar.gz |
label_read_pvid: separate error and no-pvid
error reading dev and no pvid on dev were both
returning 0. make it easier for callers to
know which, if they care.
return 1 if the device could be read, regardless
of whether a pvid was found or not.
set has_pvid=1 if a pvid is found and 0 if no
pvid is found.
Diffstat (limited to 'tools/pvscan.c')
-rw-r--r-- | tools/pvscan.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c index df38e1758..f8d27372b 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -1546,7 +1546,15 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv, label_scan_setup_bcache(); dm_list_iterate_items_safe(devl, devl2, &pvscan_devs) { - if (!label_read_pvid(devl->dev)) { + int has_pvid; + + if (!label_read_pvid(devl->dev, &has_pvid)) { + log_print("pvscan[%d] %s cannot read.", getpid(), dev_name(devl->dev)); + dm_list_del(&devl->list); + continue; + } + + if (!has_pvid) { /* Not an lvm device */ log_print("pvscan[%d] %s not an lvm device.", getpid(), dev_name(devl->dev)); dm_list_del(&devl->list); |