Skip to contentSkip to conversation

fix extended partition detection

PATCH In review Dan Williams 2 participants 2 messages Jan 25, 2011 – Jan 27, 2011 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix extended partition detection

# mdadm --detail --export /dev/md127p1

Before:
MD_LEVEL=raid5
MD_DEVICES=4
MD_METADATA=0.90

After:
MD_LEVEL=raid5
MD_DEVICES=4
MD_CONTAINER=/dev/md0
MD_MEMBER=0
MD_UUID=55746a20:925d24a7:4f9bd7e2:9c9a411f

We parse the symlink target with a format:

../../block/mdXXX/mdXXXpYY

...and need the second '/' from the end of the string to read detect a 'md' device.

---

[ sorry for any duplicates or triplicates, I failed to notice that my
MTA was misconfigured after an upgrade to F13, and all my mail from stgit was getting rejected externally. ]

If there are any 3.1.x stable releases planned I would consider this a candidate as it allows custom name partitions to be created by udev (like /dev/md/vol1p1). I believe this was masked by the usage of mdp devices.

On 3.2 it exposes a segfault as we try to get the container_content() of 'mbr' metadata.

 util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
util.c +1 -1
index c9bdd6e..75a5e6d 100644
@@ -1664,7 +1664,7 @@ int stat2devnum(struct stat *st)
 		link[n] = 0;
 		cp = strrchr(link, '/');
 		if (cp) *cp = 0;
-		cp = strchr(link, '/');
+		cp = strrchr(link, '/');
 		if (cp && strncmp(cp, "/md", 3) == 0)
 			return devname2devnum(cp+1);
 	}
#1 lore raw
Quoted 46 lines · On Mon, 24 Jan 2011 18:54:06 -0800 Dan Williams <[email protected]>…
# mdadm --detail --export /dev/md127p1

Before:
MD_LEVEL=raid5
MD_DEVICES=4
MD_METADATA=0.90

After:
MD_LEVEL=raid5
MD_DEVICES=4
MD_CONTAINER=/dev/md0
MD_MEMBER=0
MD_UUID=55746a20:925d24a7:4f9bd7e2:9c9a411f

We parse the symlink target with a format:

../../block/mdXXX/mdXXXpYY

...and need the second '/' from the end of the string to read detect a 'md' device.

Cc Przemyslaw Czarnowski

<[email protected]> Signed-off-by: Dan Williams <[email protected]> ---

[ sorry for any duplicates or triplicates, I failed to notice that my
MTA was misconfigured after an upgrade to F13, and all my mail from stgit was getting rejected externally. ]

If there are any 3.1.x stable releases planned I would consider this a candidate as it allows custom name partitions to be created by udev (like /dev/md/vol1p1). I believe this was masked by the usage of mdp devices.

On 3.2 it exposes a segfault as we try to get the container_content() of 'mbr' metadata.

 util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
util.c +0 -0
index c9bdd6e..75a5e6d 100644

util.c int stat2devnum(struct stat *st) · line 1670

Quoted 8 lines
util.c +1 -1
@@ -1664,7 +1664,7 @@ int stat2devnum(struct stat *st)
 		link[n] = 0;
 		cp = strrchr(link, '/');
 		if (cp) *cp = 0;
-		cp = strchr(link, '/');
+		cp = strrchr(link, '/');
 		if (cp && strncmp(cp, "/md", 3) == 0)
 			return devname2devnum(cp+1);
 	}

Thanks. Applied for 3.2. Hopefully I'll remember 3.1 when I get back to my other computer..

NeilBrown