linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Robert LeBlanc <robert@leblancnet.us>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: RAID without dev size prevents adding a new member
Date: Thu, 22 Dec 2016 10:27:01 +1100	[thread overview]
Message-ID: <87h95wrhh6.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAANLjFpYKFNG8mmBfVmXuOGwcs5BvMwiqjsy9nLw3LpkhGtLyg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2016-12-21 23:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20  1:01 RAID without dev size prevents adding a new member Robert LeBlanc
2016-12-21  4:58 ` NeilBrown
2016-12-21 16:44   ` Robert LeBlanc
2016-12-21 23:27     ` NeilBrown [this message]
2016-12-21 23:58       ` Robert LeBlanc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h95wrhh6.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=robert@leblancnet.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).