<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>198892</bug_id>
          
          <creation_ts>2007-11-12 06:03 0000</creation_ts>
          <short_desc>boot w/ mdadm  fails to find device nodes and also flunks multiple devices</short_desc>
          <delta_ts>2008-02-14 06:10:54 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Hosted Projects</product>
          <component>genkernel</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>robbat2@gentoo.org</reporter>
          <assigned_to>genkernel@gentoo.org</assigned_to>
          <cc>javier@miqueleiz.com</cc>

      

      
          <long_desc isprivate="0">
            <who>robbat2@gentoo.org</who>
            <bug_when>2007-11-12 06:03:23 0000</bug_when>
            <thetext>Booting on my G5, with domdadm. I have 3 MD devices, md0 = /boot, md1 = /, md2 = LVM.

&gt;&gt; Detected real_root as a md device. Setting up the device node...
mdadm: error opening /dev/md/0: No such file or directory
mdadm: failed to open array
mdadm: error opening /dev/md/1: No such file or directory
mdadm: failed to open array
mdadm: error opening /dev/md/2: No such file or directory
mdadm: failed to open array
&gt;&gt; ...

I changed the /etc/mdadm.conf in the initramfs to use the /dev/mdX names instead of /dev/md/X, and then I found that it only starts the first device listed in the mdadm.conf file.

The /etc/mdadm.conf was generated with the busybox mdadm in the first place, so I guess it fails for the lack of the /dev/md/ directory.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wolf31o2@gentoo.org</who>
            <bug_when>2007-11-13 22:50:45 0000</bug_when>
            <thetext>OK.  How do I fix it, then?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2007-11-18 22:44:35 0000</bug_when>
            <thetext>Seems a bug with busybox mdadm patch.

The function &quot;int mdassemble_main()&quot; expects the &quot;/dev/md&quot; string (without the trailing /). This function is called to assemble the arrays.

In contrast, the function &quot;brief_examine_super1()&quot; writes &quot;ARRAY /dev/md/&quot;. This function is invoked in order to examine the devices (the output of /etc/mdadm.conf comes from this one).

I tried deleting the slash in &quot;brief_examine_super1()&quot;. Now works for me. The array is assembled.

There seems to be another bug in the function &quot;int mdassemble_main()&quot;. The if condition for creating the node should be based on errno instead of the return value of strtoul(). This function returns a long value (the minor number), not an error condition.

Want to test with more than one array to verify things. But seems pretty clear.

The patch to mdadm is trivial, but can provide it anyway.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2007-11-20 12:35:01 0000</bug_when>
            <thetext>Created an attachment (id=136482)
Additional patch for busybox mdadm

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2007-11-20 12:53:50 0000</bug_when>
            <thetext>Attached the patch.

Have tested it creating up to 3 different arrays. All of them are started ok.

Have found problems if the metadata version is 1.1 or 1.2 (haven&apos;t tried with the old version 0.9). Only version 1.0 arrays are started.

BTW, sys-fs/mdadm was also affected by a bug similar to this (was fixed in release 2.6.3 though). Perhaps both bugs are related.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robbat2@gentoo.org</who>
            <bug_when>2007-11-20 14:03:18 0000</bug_when>
            <thetext>I&apos;ll try it in 12 hours or so. I have 0.9, 1.0 and 1.1 metadata arrays.

Some mdadm/kernel versions have a glitch that causes them to behave weirdly with metadata 1.0 arrays as well.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wolf31o2@gentoo.org</who>
            <bug_when>2007-11-24 15:59:52 0000</bug_when>
            <thetext>Robin:  any word?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robbat2@gentoo.org</who>
            <bug_when>2007-11-24 20:57:16 0000</bug_when>
            <thetext>Ok, it generates the mdadm.conf correctly now, 0.9 metadata works fine, v1.1 is detected, but not assembled: &apos;no devices found&apos;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2007-11-26 20:04:32 0000</bug_when>
            <thetext>Thank you for testing, Robin ;-).

You confirm we still have some bugs with versions 1.1 and 1.2. Versions 0.9 and 1.0 are working ok. I will have a look at busybox mdadm and try to propose a patch. I expect to do it this week.

BTW, could you be more explicit about that bug regarding some mdadm/kernel versions?

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robbat2@gentoo.org</who>
            <bug_when>2007-11-26 23:35:30 0000</bug_when>
            <thetext>For the main mdadm/kernel bugs, boot one of the pre-release 2007.1 media (I ran into the bug on the ppc64 media that I was testing for rangerpb), and try to create a 1.0 array. It will be created, but mdadm will fail to start it. If you then try to assemble it manually using the sysfs interface, you&apos;ll get a backtrace in the kernel, and the box hangs in some cases.
That&apos;s why my md3 is v1.1 actually. I prefer 1.0 and 0.9, since the superblocks are at the end of the device, so they don&apos;t block unmodified booting of a RAID1 device.
I was using real disk, and I&apos;m not sure if it happens with loop devices offhand (it should tho).

(see &quot;man md&quot; for the exact details).
0.9 - superblock located in the last 64-128K of device, 64Kb in size. 
1.0 - superblock located in the last 8-12K of device.
1.1 - at start of device.
1.2 - starting at 4K in the device.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wolf31o2@gentoo.org</who>
            <bug_when>2007-11-28 21:46:49 0000</bug_when>
            <thetext>I&apos;ve gone ahead and added this.  I&apos;d rather we support *some* of the versions than none.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wolf31o2@gentoo.org</who>
            <bug_when>2007-11-28 22:32:08 0000</bug_when>
            <thetext>This should be done in 3.4.9_pre10 which will be hitting the tree soon.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2007-11-29 19:46:15 0000</bug_when>
            <thetext>Seems reasonable to me. We only gain functionality since it doesn&apos;t work now.

A fully working version supporting all 4 metadata types could be released in another genkernel revision.

Just my opinion. I would like to hear Robin about this.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>robbat2@gentoo.org</who>
            <bug_when>2007-11-29 20:22:12 0000</bug_when>
            <thetext>we&apos;re only moving forward by including it, no objections from me.
getting there in small steps is a help when doing a big step in one go isn&apos;t available.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2008-02-11 06:59:48 0000</bug_when>
            <thetext>Attached a new patch against sys-kernel/genkernel-3.4.9 to support all 4 metadata versions (i.e., 0.9, 1.0, 1.1 and 1.2).

The patch is based on some changes from full mdadm-2.6.2 to mdadm-2.6.3 (so credit should go to Neil Brown).

Have reasonably tested and think it should work fine.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>javier@miqueleiz.com</who>
            <bug_when>2008-02-11 07:01:36 0000</bug_when>
            <thetext>Created an attachment (id=143185)
Additional patch to support 1.1 and 1.2 metadata versions

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wolf31o2@gentoo.org</who>
            <bug_when>2008-02-14 06:10:54 0000</bug_when>
            <thetext>OK, I added the mdadm3 patch to SVN, so it&apos;ll show up in 3.4.10_pre2...</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>136482</attachid>
            <date>2007-11-20 12:35 0000</date>
            <desc>Additional patch for busybox mdadm</desc>
            <filename>busybox-1.1.3+gentoo-mdadm-r1.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">ZGlmZiAtdXIgYnVzeWJveC0xLjEuMytnZW50b28vbWRhZG0vbWRhc3NlbWJsZS5jIGJ1c3lib3gt
MS4xLjMrZ2VudG9vLW1kYWRt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yMS5jCTIwMDctMTEtMjAgMTE6MjQ6NDguMDAwMDAw
MDAwICswMTAwCkBAIC0xNTYsNyArMTU2LDcgQEAKIAllbHNlCiAJCW5tID0gIj8/IjsKIAotCXBy
aW50ZigiQVJSQVkgL2Rldi9tZC8lcyBsZXZlbD0lcyBtZXRhZGF0YT0xIG51bS1kZXZpY2VzPSVk
IFVVSUQ9IiwKKwlwcmludGYoIkFSUkFZIC9kZXYvbWQlcyBsZXZlbD0lcyBtZXRhZGF0YT0xIG51
bS1kZXZpY2VzPSVkIFVVSUQ9IiwKIAkgICAgICAgbm0sCiAJICAgICAgIGM/YzoiLXVua25vd24t
IiwgX19sZTMyX3RvX2NwdShzYi0+cmFpZF9kaXNrcykpOwogCWZvciAoaT0wOyBpPDE2OyBpKysp
IHsK
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>143185</attachid>
            <date>2008-02-11 07:01 0000</date>
            <desc>Additional patch to support 1.1 and 1.2 metadata versions</desc>
            <filename>busybox-1.1.3+gentoo-mdadm3.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">ZGlmZiAtdXIgYnVzeWJveC0xLjEuMytnZW50b28vbWRhZG0vc3VwZXIxLmMgYnVzeWJveC0xLjEu
MytnZW50b28tbWRhZG0tcjIvbWRhZG0vc3VwZXIxLmMKLS0tIGJ1c3lib3gtMS4xLjMrZ2VudG9v
L21kYWRtL3N1cGVyMS5jCTIwMDgtMDItMTAgMTk6MDc6NTEuMDAwMDAwMDAwICswMTAwCisrKyBi
dXN5Ym94LTEuMS4zK2dlbnRvby1tZGFkbS1yMi9tZGFkbS9zdXBlcjEuYwkyMDA4LTAyLTA1IDIy
OjE5OjMyLjAwMDAwMDAwMCArMDEwMApAQCAtMTQ1LDYgKzE0NSw3IEBACiB7CiAJc3RydWN0IG1k
cF9zdXBlcmJsb2NrXzEgKnNiID0gc2J2OwogCWludCBpOworCXVuc2lnbmVkIGxvbmcgbG9uZyBz
Yl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