Skip to contentSkip to conversation

master - cov: add missing error path check for label_scan_open

PATCH Zdenek Kabelac 1 participant 1 message Oct 15, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=84f00f50584b0c1c0464a414c71cd112e4d30c22
Commit:        84f00f50584b0c1c0464a414c71cd112e4d30c22
Parent:        b57e73a0f1376ea114451c0172f0ef0adbd3123f
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Oct 15 16:39:28 2018 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Oct 15 17:49:44 2018 +0200

cov: add missing error path check for label_scan_open

---
 lib/label/label.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
lib/label/label.c +5 -1
index 3901a86..6c074d6 100644
@@ -1067,7 +1067,11 @@ int label_read_sector(struct device *dev, uint64_t read_sector)
 	block_sector = block_num * BCACHE_BLOCK_SIZE_IN_SECTORS;
 	start_sector = read_sector % BCACHE_BLOCK_SIZE_IN_SECTORS;
 
-	label_scan_open(dev);
+	if (!label_scan_open(dev)) {
+		log_error("Error opening device %s for prefetch %llu sector.",
+			  dev_name(dev), (unsigned long long)block_num);
+		return false;
+	}
 
 	bcache_prefetch(scan_bcache, dev->bcache_fd, block_num);