From ce4e728a2d7b9fd8fda7cb8cabb0af763abac886 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Wed, 13 Mar 2019 20:14:33 +0800
Subject: [PATCH 10/19] cov: add missing error path check for label_scan_open

---
 lib/label/label.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/label/label.c b/lib/label/label.c
index 86c84d8..63300d2 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1087,7 +1087,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);
 
-- 
2.19.1

