Blame SOURCES/util-must_be-container1-Use-sysfs_read-GET_VERSION-to.patch

b7f731
From f5c924f441cedce2a13c48b12be35250560ee575 Mon Sep 17 00:00:00 2001
b7f731
From: Jes Sorensen <Jes.Sorensen@gmail.com>
b7f731
Date: Wed, 5 Apr 2017 14:01:30 -0400
b7f731
Subject: [RHEL7.5 PATCH 052/169] util/must_be_container: Use
b7f731
 sysfs_read(GET_VERSION) to determine valid array
b7f731
b7f731
Use sysfs_read() instead of ioctl(RAID_VERSION) to determine this is
b7f731
in fact a valid raid array fd.
b7f731
b7f731
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
b7f731
---
b7f731
 util.c | 7 ++++++-
b7f731
 1 file changed, 6 insertions(+), 1 deletion(-)
b7f731
b7f731
diff --git a/util.c b/util.c
b7f731
index 9fc7ba0..56daee3 100644
b7f731
--- a/util.c
b7f731
+++ b/util.c
b7f731
@@ -1376,9 +1376,14 @@ int get_dev_sector_size(int fd, char *dname, unsigned int *sectsizep)
b7f731
  */
b7f731
 int must_be_container(int fd)
b7f731
 {
b7f731
+	struct mdinfo *mdi;
b7f731
 	unsigned long long size;
b7f731
-	if (md_get_version(fd) < 0)
b7f731
+
b7f731
+	mdi = sysfs_read(fd, NULL, GET_VERSION);
b7f731
+	if (!mdi)
b7f731
 		return 0;
b7f731
+	sysfs_free(mdi);
b7f731
+
b7f731
 	if (get_dev_size(fd, NULL, &size) == 0)
b7f731
 		return 1;
b7f731
 	if (size == 0)
b7f731
-- 
b7f731
2.7.4
b7f731