Re: RAID without dev size prevents adding a new member

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

 



On Thu, Dec 22 2016, Robert LeBlanc wrote:

> It looks like it is still there on the latest master.

Thanks for checking!

>
> # ./mdadm --version
> mdadm - v3.4-88-gfa219dd - 22nd September 2016
>
> # ./mdadm --detail /dev/md_root
> /dev/md_root:
>         Version : 1.0
>   Creation Time : Wed Sep  7 15:58:30 2016
>      Raid Level : raid1
>      Array Size : 5368708928 (5120.00 GiB 5497.56 GB)
>   Used Dev Size : unknown

This implies that mdadm is opening /dev/md_root/md/component_size ....

Ah-ha.  get_component_size() hasn't been updated to work with named
arrays. it will only open
			"/sys/block/md%d/md/component_size",
or
			"/sys/block/md_d%d/md/component_size",

Please try with the following patch.  I'll send a proper version to Jes.

Thanks,
NeilBrown

diff --git a/sysfs.c b/sysfs.c
index 84c7348526c9..b0657a04b3a3 100644
--- a/sysfs.c
+++ b/sysfs.c
@@ -400,14 +400,8 @@ unsigned long long get_component_size(int fd)
 	int n;
 	if (fstat(fd, &stb))
 		return 0;
-	if (major(stb.st_rdev) != (unsigned)get_mdp_major())
-		snprintf(fname, MAX_SYSFS_PATH_LEN,
-			"/sys/block/md%d/md/component_size",
-			(int)minor(stb.st_rdev));
-	else
-		snprintf(fname, MAX_SYSFS_PATH_LEN,
-			"/sys/block/md_d%d/md/component_size",
-			(int)minor(stb.st_rdev)>>MdpMinorShift);
+	snprintf(fname, MAX_SYSFS_PATH_LEN,
+		 "/sys/block/%s/md/component_size", stat2devnm(&stb));
 	fd = open(fname, O_RDONLY);
 	if (fd < 0)
 		return 0;

Attachment: signature.asc
Description: PGP signature


[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