[klibc] [patch] skip existing md devices

H. Peter Anvin hpa at zytor.com
Wed May 10 16:12:48 PDT 2006


Aaron Griffin wrote:
> On 5/10/06, H. Peter Anvin <hpa at zytor.com> wrote:
>> Aaron Griffin wrote:
>> > The following patch will ignore already configured md devices in
>> > kinit.  The rationale is that, if an md device already exists, it was
>> > previously assembled by some other tool (e.g. mdadm) and should remain
>> > there.  Currently, kinit removes it and attempts to recreate it, which
>> > can cause all sorts of issues, especially in the situation that, the
>> > md device is further encrypted and/or is an lvm volume.
>>
>> I'm not sure if the existence of a device node in /dev should be 
>> sufficient to suppress
>> operation on that md device.  It would probably be better off querying 
>> the md device for
>> its state (via the GET_ARRAY_INFO) ioctl and skip it if it is running 
>> (or even just
>> assembled?)
> 
> My 2 cents is that that may make sense in normal userspace, but in
> early-userspace it's pretty clear - if it exists it was explicitly
> created and assembled, unless of course someone oddly did a 'mknod' or
> some such nonsense.
> 
> Still, you might be right.  It may be more proper to use some ioctls.

Case in point: an earlier program might have done an md operation -- even just check for 
presence -- but left the device node around; or some users might have a prepopulated /dev 
in early userspace.  Both are entirely legitimate.

	-hpa



More information about the klibc mailing list