dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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