linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Create new md devices consistently
@ 2012-10-23 22:04 Justin Maggard
  2012-10-24  1:09 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Justin Maggard @ 2012-10-23 22:04 UTC (permalink / raw)
  To: linux-raid; +Cc: Justin Maggard

 Creating a new MD device with the name 'd-0' results in some
 unexpected behavior, since mdadm sees that '-0' is a
 non-negative integer and therefore makes a "partitionable"
 device (/dev/md_d0).  This is not the expected behavior,
 since the documentation mentions 'dN' several places, and a
 reboot brings it up as /dev/md/d-0.  Make this consistent
 by ensuring that the character immediately following 'd' is
 a digit during creation.

---
 mdopen.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mdopen.c b/mdopen.c
index 61eda81..24188df 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -207,7 +207,10 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
 			char *ep;
 			if (cname[0] == 'd')
 				sp++;
-			num = strtoul(sp, &ep, 10);
+			if (isdigit(sp[0]))
+				num = strtoul(sp, &ep, 10);
+			else
+				ep = sp;
 			if (ep == sp || *ep || num < 0)
 				num = -1;
 			else if (cname[0] == 'd')
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-24  1:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-23 22:04 [PATCH] Create new md devices consistently Justin Maggard
2012-10-24  1:09 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).