[PATCH 17/34] imsm: FIX: Fill sys_name in container_content()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If sys_name field is empty structures produced by container_content()
cannot be used for sysfs access.

Signed-off-by: Adam Kwolek <adam.kwolek@xxxxxxxxx>
---

 super-intel.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index de3585e..f07665b 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4517,6 +4517,9 @@ static void update_recovery_start(struct imsm_dev *dev, struct mdinfo *array)
 	rebuild->recovery_start = units * blocks_per_migr_unit(dev);
 }
 
+static int imsm_find_array_minor_by_subdev(int subdev,
+					   int container,
+					   int *minor);
 
 static struct mdinfo *container_content_imsm(struct supertype *st, char *subarray)
 {
@@ -4545,6 +4548,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 		struct mdinfo *this;
 		int slot;
 		char *ep;
+		int minor;
 
 		if (subarray &&
 		    (i != strtoul(subarray, &ep, 10) || *ep != '\0'))
@@ -4575,6 +4579,14 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 
 		super->current_vol = i;
 		getinfo_super_imsm_volume(st, this, NULL);
+
+		if (imsm_find_array_minor_by_subdev(i,
+						    st->container_dev,
+						    &minor) >= 0) {
+			sprintf(this->sys_name, "md%i", minor);
+		}
+
+
 		for (slot = 0 ; slot <  map->num_members; slot++) {
 			unsigned long long recovery_start;
 			struct mdinfo *info_d;

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux