diff options
author | Labun, Marcin <Marcin.Labun@intel.com> | 2011-01-25 15:59:32 +0000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-27 12:48:04 +1000 |
commit | 20b60dcd6cea6cb517cea31056241607a2964e5d (patch) | |
tree | 0f7e2f1d5a24af137a68b2137cbac485452a7df8 /mdadm.c | |
parent | d6bd632c412456256432a3e8e568ac53ffba21fb (diff) | |
download | mdadm-20b60dcd6cea6cb517cea31056241607a2964e5d.tar.gz |
Dynamic hot-plug udev rules for policies
Neil,
Please consider this patch that once was discussed and I think agreed with in general direction. It was sent a while ago
but somehow did not merged into your devel3-2. This patch enables hot-plug of so called bare devices (as understand by domain policies rules in mdadm.conf).
Without this patch we do NOT serve hot-plug of bare devices at all.
Thanks,
Marcin Labun
Subject was: FW: Autorebuild, new dynamic udev rules for hot-plugs
>>From c0aecd4dd96691e8bfa6f2dc187261ec8bb2c5a2 Mon Sep 17 00:00:00 2001
From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Date: Thu, 23 Dec 2010 16:35:01 +0100
Subject: [PATCH] Dynamic hot-plug udev rules for policies
Cc: linux-raid@vger.kernel.org, Williams, Dan J <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>
When introducing policies, new hot-plug rules were added to support
bare disks. Mdadm was started for each hot plugged block device
to determine if it could be used as spare or as a replacement member for
degraded array.
This patch introduces limitation of range of devices that are handled
by mdadm.
It limits them to the ones specified in domains associated with
the actions: spare-same-port, spare and spare-force.
In order to enable hot-plug for bare disks one must update udev rules
with command
mdadm --activate-domains[=filename]
Above command writes udev rule configuration to stdout. If 'filename'
is given output is written to the file provided as parameter. It is up
to system administrator what should be done later. To make such rule
permanent (i.e. remain after reboot) rule should be writen to
/lib/udev/rules.d directory. Other cases will just need to write it to
/dev/.udev/rules.d directory where temporary rules lies. One should be
aware of the meaning of names/priorities of the udev rules.
After mdadm.conf is changed one is obliged to re-run
"mdadm --activate-domains" command in order to bring the system
configuration up to date.
All hot-plugged disks containing metadata are still handled by existing
rules.
Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -106,6 +106,7 @@ int main(int argc, char *argv[]) int auto_update_home = 0; char *subarray = NULL; char *remove_path = NULL; + char *udev_filename = NULL; int print_help = 0; FILE *outf; @@ -234,6 +235,7 @@ int main(int argc, char *argv[]) } subarray = optarg; } + case UdevRules: case 'K': if (!mode) newmode = MISC; break; case NoSharing: newmode = MONITOR; break; } @@ -929,6 +931,20 @@ int main(int argc, char *argv[]) } devmode = opt; continue; + case O(MISC, UdevRules): + if (devmode && devmode != opt) { + fprintf(stderr, Name ": --udev-rules must" + " be the only option.\n"); + } else { + if (udev_filename) + fprintf(stderr, Name ": only specify one udev " + "rule filename. %s ignored.\n", + optarg); + else + udev_filename = optarg; + } + devmode = opt; + continue; case O(MISC,'t'): test = 1; continue; @@ -1493,6 +1509,8 @@ int main(int argc, char *argv[]) free_mdstat(ms); } while (!last && err); if (err) rv |= 1; + } else if (devmode == UdevRules) { + rv = Write_rules(udev_filename); } else { fprintf(stderr, Name ": No devices given.\n"); exit(2); |