Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 354809 - regression in handling of mdadm.conf
Summary: regression in handling of mdadm.conf
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-02-14 05:47 UTC by Xake
Modified: 2011-03-16 14:54 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-Look-for-sanity-in-mdadm.conf.patch (0001-Look-for-sanity-in-mdadm.conf.patch,1.30 KB, patch)
2011-02-14 07:56 UTC, Xake
Details | Diff
0002-Introducing-MDADM_CONFIG.patch (0002-Introducing-MDADM_CONFIG.patch,2.19 KB, patch)
2011-02-14 07:56 UTC, Xake
Details | Diff
0001-Introducing-MDADM_CONFIG.patch (0001-Introducing-MDADM_CONFIG.patch,4.29 KB, patch)
2011-02-23 06:27 UTC, Xake
Details | Diff
0002-Do-not-mess-with-MDADMs-auto-detect.patch (0002-Do-not-mess-with-MDADMs-auto-detect.patch,1.31 KB, patch)
2011-02-23 06:27 UTC, Xake
Details | Diff
docs: Improve docs on MDADM_CONFIG (0001-docs-Improve-docs-on-MDADM_CONFIG.patch,1.43 KB, patch)
2011-02-24 09:37 UTC, Sebastian Pipping
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xake 2011-02-14 05:47:18 UTC
We currentl have a problem, namely that we currently need MDADM="yes" in genkernel.conf to get any implementation of mdadm into the genkernel, right? However that option willgive two problems:

1. Currently there is no check if /etc/mdadm.conf even exists before trying to copy it, which breaks "rm /etc/mdadm.conf && genkernel ramdisk --mdadm"
2. sys-fs/mdadm installs a /etc/mdadm.conf only containing comments. This leads to the ramdisk finding a /etc/mdadm.conf, which makes it skip autodetection, and since then "mdadm --assebmle --scan" runs against an empty mdadm.conf no arrays are being enabled.

The second one breaks for example running "domdadm" on livecds and such that needs autodetecting. The first one broke an old workaround for said problem (and genkernel --mdadm really should not need any mdadm merged onto the system).


So how should we fix this?
There are things in mdadm.conf that people may want to have even if they want the ramdisk to auto-detect arrays (i.e. DEVICE,HOMEHOST,AUTO).
However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I propose that we in the ramdisk check if the mdadm.conf contains any non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine --scan >> /etc/mdadm.conf" as we do today to add those lines.
How does that sound?


As for the first problem, I think about introducing a MDADM_CONFIG to genkernel.conf, which could be set to three values: empty (look for /etc/mdadm.conf and use that), string (look for file, and use as mdadm.conf in ramdisk), and none (do not copy mdadm.conf to ramdisk) and in the same time build in checks to see if the file exists before trying to copy it.
Comment 1 Xake 2011-02-14 07:56:00 UTC
Created attachment 262415 [details, diff]
0001-Look-for-sanity-in-mdadm.conf.patch

Make sure that mdadm.conf conatins any arrays ro activate
Comment 2 Xake 2011-02-14 07:56:58 UTC
Created attachment 262417 [details, diff]
0002-Introducing-MDADM_CONFIG.patch

Introduce MDADM_CONFIG if you want another mdadm.conf in your ramdisk then on your system
Comment 3 Xake 2011-02-21 18:38:27 UTC
Comment on attachment 262415 [details, diff]
0001-Look-for-sanity-in-mdadm.conf.patch

Ok, this needs rework as "mdadm --assemble --scan" nowdays both autodetects and assembles drives, so the whole "--examine --scan" is unnecessary
Comment 4 Xake 2011-02-21 18:39:55 UTC
Comment on attachment 262417 [details, diff]
0002-Introducing-MDADM_CONFIG.patch

I am going to rework this, so that we use "none" as default, and so the autodetection as default. This way, the MDADM_CONFIG becomes something for more advanced users, who may have alterations for /etc/mdadm.conf
Comment 5 Xake 2011-02-21 18:47:17 UTC
Forgot to write that currently there is a problem in "mdadm --assemble --scan" if there are ARRAYs defined in /etc/mdadm.conf, namely devnodes for partitions are not created.

Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at least for my booting raid when I have two, could be the assembling order) and have the ARRAys defined, then mdadm will create /dev/md126, but not /dev/md126p1.
If you however let "mdadm --assemble --scan" do the detection, then the partitions will be created too.

I have yet to look into the mdadm sources, but I think it is related to some syscall not being done properly, as the partitions are listed in /proc/partitions and anything like "mdadm -E /dev/126" or "vgscan" and the devnodes are being created in my devtmpfs.
Comment 6 Sebastian Pipping gentoo-dev 2011-02-22 03:53:11 UTC
(In reply to comment #0)
> 1. Currently there is no check if /etc/mdadm.conf even exists before trying to
> copy it, which breaks "rm /etc/mdadm.conf && genkernel ramdisk --mdadm"

Okay, that's a bug.


> 2. sys-fs/mdadm installs a /etc/mdadm.conf only containing comments. This leads
> to the ramdisk finding a /etc/mdadm.conf, which makes it skip autodetection,
> and since then "mdadm --assebmle --scan" runs against an empty mdadm.conf no
> arrays are being enabled.

I see, that's bad.


> However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I
> propose that we in the ramdisk check if the mdadm.conf contains any
> non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine
> --scan >> /etc/mdadm.conf" as we do today to add those lines.
> How does that sound?

Sounds good to me, unless you object to this approach yourself by now.  Not sure if I got all of the details.


(In reply to comment #5)
> Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at
> least for my booting raid when I have two, could be the assembling order) and
> have the ARRAys defined, then mdadm will create /dev/md126, but not
> /dev/md126p1.

By chance, could this post-3.1.4 commit be related in any way?
http://neil.brown.name/git?p=mdadm;a=commitdiff;h=f58dd437412348b77bc09b79c656cf3472e9913d
Comment 7 Xake 2011-02-22 21:23:09 UTC
(In reply to comment #6)
> (In reply to comment #0)
> > However for the ramdisk it is essential that mdadm.conf contains ARRAY, so I
> > propose that we in the ramdisk check if the mdadm.conf contains any
> > non-commented ARRAY lines. If we cannot find it we run the "mdadm --examine
> > --scan >> /etc/mdadm.conf" as we do today to add those lines.
> > How does that sound?
> 
> Sounds good to me, unless you object to this approach yourself by now.  Not
> sure if I got all of the details.
> 
> 

Well, I was a bit confusing.
But the "--emanie --scan" part will go totally. There is no need to add ARRAY to mdadm.conf, as if they are not defined already "mdadm --assemble --scan" will scan entries in /proc/partitons for disks with RAID-markings.

> (In reply to comment #5)
> > Currently if I have ONE fakeraid (for some reason mdadm creates the nodes at
> > least for my booting raid when I have two, could be the assembling order) and
> > have the ARRAys defined, then mdadm will create /dev/md126, but not
> > /dev/md126p1.
> 
> By chance, could this post-3.1.4 commit be related in any way?
> http://neil.brown.name/git?p=mdadm;a=commitdiff;h=f58dd437412348b77bc09b79c656cf3472e9913d
> 

I do not know, that git seems currently down. Will return when I have an answer. But with the logic I have thoughts about using, that bug will only be exposed if a user declares a mdadm.conf to be copied to the ramdisk containing a partitioned RAID.
Comment 8 Xake 2011-02-23 06:27:22 UTC
Created attachment 263599 [details, diff]
0001-Introducing-MDADM_CONFIG.patch

Make mdadm.conf costumizable, also fixes the mentioned regression
Comment 9 Xake 2011-02-23 06:27:55 UTC
Created attachment 263601 [details, diff]
0002-Do-not-mess-with-MDADMs-auto-detect.patch

Remove messing with autodetection, as this breaks fakeraids
Comment 10 Sebastian Pipping gentoo-dev 2011-02-24 09:37:52 UTC
Created attachment 263669 [details, diff]
docs: Improve docs on MDADM_CONFIG

Thanks for these patches.  Very nice.  Pushed to experimental.

Here's a patch I applied on top of yours.

Please make sure to check "patch" when uploading attachments.
Comment 11 Xake 2011-02-24 17:52:13 UTC
(In reply to comment #10)
> Created an attachment (id=263669) [details]
> docs: Improve docs on MDADM_CONFIG
> 
> Thanks for these patches.  Very nice.  Pushed to experimental.
> 
> Here's a patch I applied on top of yours.
> 

Thanks, feels much clearer.

> Please make sure to check "patch" when uploading attachments.
> 

Heh, yeah. I usually use pybugz, and forgets about the flag...:/