File bug-1164718_16-cov-check-lv_info.patch of Package lvm2.15869

From 2cd6cd34394cb25d312c73b979f4e536d431c10b Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 25 Jun 2019 14:52:19 +0200
Subject: [PATCH] cov: check lv_info

Use lv_info results only when valid.
---
 lib/label/label.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/label/label.c b/lib/label/label.c
index 6d8156e91..83b4d995c 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1139,10 +1139,11 @@ void label_scan_invalidate_lv(struct cmd_context *cmd, struct logical_volume *lv
 	struct device *dev;
 	dev_t devt;
 
-	lv_info(cmd, lv, 0, &lvinfo, 0, 0);
-	devt = MKDEV(lvinfo.major, lvinfo.minor);
-	if ((dev = dev_cache_get_by_devt(devt, NULL)))
-		label_scan_invalidate(dev);
+	if (lv_info(cmd, lv, 0, &lvinfo, 0, 0)) {
+		devt = MKDEV(lvinfo.major, lvinfo.minor);
+		if ((dev = dev_cache_get_by_devt(devt, NULL)))
+			label_scan_invalidate(dev);
+	}
 }
 
 /*
-- 
2.24.0

openSUSE Build Service is sponsored by