diff --git a/tools/pvscan.c b/tools/pvscan.c index 389aafafc..c48453136 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -644,6 +644,8 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev, const struct format_type *fmt; /* Create a dummy instance. */ struct format_instance_ctx fic = { .type = 0 }; + uint32_t ext_version; + uint32_t ext_flags; int ret = 0; log_debug("pvscan metadata from dev %s", dev_name(dev)); @@ -667,6 +669,14 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev, return 1; } + ext_version = lvmcache_ext_version(info); + ext_flags = lvmcache_ext_flags(info); + + if ((ext_version >= 2) && !(ext_flags & PV_EXT_USED)) { + log_print("pvscan[%d] PV %s not used.", getpid(), dev_name(dev)); + return 1; + } + fmt = lvmcache_fmt(info); baton.cmd = cmd;