On Thu, 2008-10-30 at 09:56 +1100, Neil Brown wrote: > That leaves a largish slab of your code that I wasn't really sure > what it was adding. It was dealing with the fact that is_standard() has more than just two return values. It has -1, 0, and 1 (and 2 in my patch, but you've changed yours in such a way that it's not necessary any more). That makes this test fail for certain ARRAY lines: > + if (match && (rv = is_standard(match->devname, &devnum))) { > + devnum = (rv > 0) ? (-1-devnum) : devnum; As an example, create an array that doesn't use standard syntax, in my case I was testing with /dev/md/root as a partitioned array. The array line in my mdadm.conf looked like this: ARRAY /dev/md/root level=raid1 num-devices=2 metadata=0.90 auto=mdp4 UUID=e38b03c0:444d484e:910e8462:063f083e Given a command invocation of mdadm -I <device>, and that device's uuid matches the above array line, you really want to use the information in the ARRAY line whether is_standard returns -1, 0, or 1. So, that big multiswitch statement was the possible invocations of mdadm -I with a device that matches the array UUID in the config file but uses a non-standard name, eg someone did a create on /dev/md0, then a -Eb >> mdadm.conf, then vi mdadm.conf and add auto=mdp4 to the ARRAY /dev/md0 line. Obviously, we would have refused to create the array with that name and that auto setting, so I was preserving that behavior at run time too. Hence the size of that section of code. -- Doug Ledford <dledford@xxxxxxxxxx> GPG KeyID: CFBFF194 http://people.redhat.com/dledford Infiniband specific RPMs available at http://people.redhat.com/dledford/Infiniband
Attachment:
signature.asc
Description: This is a digitally signed message part