LWN.net Logo

Add hot-unplug support to mdadm

From:  Doug Ledford <dledford@redhat.com>
To:  Linux RAID Mailing List <linux-raid@vger.kernel.org>, Neil Brown <neilb@suse.de>, Dan Williams <dan.j.williams@intel.com>
Subject:  [Patch mdadm] Add hot-unplug support to mdadm
Date:  Mon, 05 Apr 2010 12:40:41 -0400
Archive-link:  Article, Thread

We have incremental mode for supporting hot plug of devices.  However,
we don't support hot-unplug.  This is something we need in order to
enable automatic device replacement.  When implementing the support
though, I found that we had a problem in that the device special file is
already gone (well, not gone, but both open and lstat fail on the device
special file, which really makes Manage_subdevs unhappy) by the time
udev calls us to remove the device (even if I created a new udev rules
file with a very low number this was still true).  So, along with adding
the code shamelessly stolen from Hawrylewicz with modifications to make
it work on non-container based arrays, I had to modify Manage_subdevs to
work on sysfs subdevice entries in the fail and remove cases.  Anyway,
with this in place, and with the modified udev rules file in place,
hot-unplug now works (or at least it does in my testing, I didn't try a
container device, I'll leave tweaking that to Dan or someone else from
Intel, although it should more or less work, I don't know the Intel
metadata rules and so didn't try to make it work myself).  And by
changing Manage_subdevs to use either a valid device special file or
sysfs entries, it will work on the command line with virtually any
kernel, and work from a udev rules file on kernels recent enough to have
the state entry in sysfs subdevs directories.

Oh, and Neil should review my man page additions to see if they are
sufficient for his tastes.  I didn't get real wordy about the support,
it's pretty straight forward.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: CFBFF194
	      http://people.redhat.com/dledford

Infiniband specific RPMs available at
	      http://people.redhat.com/dledford/Infiniband
[2. text/plain; mdadm-decremental.patch]...


Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds