[PATCH 12/12] Detail.c: call load_container for container subarrays

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

 



Without calling load_container at this point, the
info structure may be missing some important information.
In particular, information about secondary DDF RAID levels
may be wrong if information is only read from a single disk.

If this fails, fall back to the previous code.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 Detail.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Detail.c b/Detail.c
index ab49803..9e52de8 100644
--- a/Detail.c
+++ b/Detail.c
@@ -103,13 +103,21 @@ int Detail(char *dev, struct context *c)
 		 * We want the name of the container, and the member
 		 */
 		int dn = st->container_dev;
+		int cfd, err;
 
 		member = subarray;
 		container = map_dev_preferred(dev2major(dn), dev2minor(dn), 1, c->prefer);
+		cfd = open_dev(st->container_dev);
+		if (cfd >= 0) {
+			err = st->ss->load_container(st, cfd, NULL);
+			close(cfd);
+			if (err == 0)
+				info = st->ss->container_content(st, subarray);
+		}
 	}
 
 	/* try to load a superblock */
-	if (st) for (d = 0; d < max_disks; d++) {
+	if (st && !info) for (d = 0; d < max_disks; d++) {
 		mdu_disk_info_t disk;
 		char *dv;
 		int fd2;
-- 
1.7.3.4
--
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