Bug#382326: missing /dev/mdX cause assembly to fail *and* to generate missing nodes

Neil Brown neilb at suse.de
Fri Aug 11 06:09:40 UTC 2006


On Thursday August 10, madduck at madduck.net wrote:
> Package: mdadm
> Version: 2.5.3-1~unreleased.3
> Severity: normal
> 
> Dear Neil,
> 
> Here's an issue I've stumbled over today: say /etc/mdadm/mdadm.conf
> refers to /dev/md1, but that does not exist during boot and udev
> does *not* create it. Now, check this out:

Does mdadm.conf only have md1?  or does it have md5 and md6 as well?

> 
>   mdadm:~# rm /dev/md?
>   mdadm:~# mdadm -As
>   mdadm: No arrays found in config file or automatically

Looking at the 'strace' of that I see e.g.

    stat64("/dev/md5", 0xaf81cf00)          = -1 ENOENT (No such file or directory)
    mknod("/dev/md5", S_IFBLK|0600, makedev(9, 5)) = 0
    chown32("/dev/md5", 0, 6)               = 0
    chmod("/dev/md5", 0660)                 = 0
    stat64("/dev/md5", {st_mode=S_IFBLK|0660, st_rdev=makedev(9, 5), ...}) = 0
    open("/dev/md5", O_RDWR)                = 3

It didn't exist, so it made it, and then:

    fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(9, 5), ...}) = 0
    ioctl(3, 0x800c0910, 0xaf81cf58)        = 0
That was RAID_VERSION
    ioctl(3, 0x80480911, 0xaf81d370)        = 0
and that was GET_ARRAY_INFO
it didn't return -ENODEV, so the array must be at least partly
assembled.
My guess would be that it got assembled as /dev/md/5  or some other name.
What did 'cat /proc/mdstat' show before hand?
What about ls -l /dev/md/ ??


>   mdadm:~# ls /dev/md?
>   /dev/md1  /dev/md5  /dev/md6
>   mdadm:~# mdadm -As
>   mdadm: /dev/md5 is already active.
>   mdadm: /dev/md1 is already active.
>   mdadm: /dev/md6 is already active.

Hmm.. that's not what I would have wanted. "mdadm -As" was meant to be
silent about already-active arrays.  It was the first time.
But this is coming from 'open_mddev' which has been asked to create
a device, but found that it already existed and was active.
I'll have to think about that.

> 
> So it seems that mdadm creates the device nodes even though it does
> not find any. On second try then, of course, it works.

I'm not sure what "creates the device nodes even though it does not
find any" means....
In both cases, mdadm discovered that the arrays listed in mdadm.conf
were already assembled, and so didn't assemble them.  The first time
it had to create the device nodes first.

NeilBrown




More information about the pkg-mdadm-devel mailing list