From e6d35874827f14d392c4ba4f8608eb0444230c7b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 21 Sep 2021 18:50:26 +0200 Subject: [PATCH] cov: check dev_get_size result Check we have obtained some device size out of dev_get_size(). --- tools/pvscan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/pvscan.c b/tools/pvscan.c index b19b74b3e..a0be17e8e 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -1268,8 +1268,12 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs } devsize = dev->size; - if (!devsize) - dev_get_size(dev, &devsize); + if (!devsize && + !dev_get_size(dev, &devsize)) { + log_print("pvscan[%d] PV %s can get device size.", getpid(), dev_name(dev)); + release_vg(vg); + continue; + } do_full_check = 0; /* If use_full_md_check is set then this has already been done by filter. */