summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Incremental.c8
-rw-r--r--ReadMe.c2
-rw-r--r--mdadm.c17
-rw-r--r--mdadm.h3
-rw-r--r--udev-md-raid.rules2
5 files changed, 23 insertions, 9 deletions
diff --git a/Incremental.c b/Incremental.c
index b7bf0b4f..a2235530 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1351,17 +1351,23 @@ static int Incremental_container(struct supertype *st, char *devname,
* raid arrays, and if so first fail (if needed) and then remove the device.
*
* @devname - The device we want to remove
+ * @id_path - name as found in /dev/disk/by-path for this device
*
* Note: the device name must be a kernel name like "sda", so
* that we can find it in /proc/mdstat
*/
-int IncrementalRemove(char *devname, int verbose)
+int IncrementalRemove(char *devname, char *id_path, int verbose)
{
int mdfd;
int rv;
struct mdstat_ent *ent;
struct mddev_dev devlist;
+ if (!id_path)
+ dprintf(Name ": incremental removal without --path <id_path> "
+ "lacks the possibility to re-add new device in this "
+ "port\n");
+
if (strchr(devname, '/')) {
fprintf(stderr, Name ": incremental removal requires a "
"kernel device name, not a file: %s\n", devname);
diff --git a/ReadMe.c b/ReadMe.c
index b97c55e7..07abdb7d 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -191,6 +191,8 @@ struct option long_options[] = {
/* For Incremental */
{"rebuild-map", 0, 0, 'r'},
+ {"path", 1, 0, IncrementalPath},
+
{0, 0, 0, 0}
};
diff --git a/mdadm.c b/mdadm.c
index 4a854748..0eef6bc8 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -104,6 +104,7 @@ int main(int argc, char *argv[])
int rebuild_map = 0;
int auto_update_home = 0;
char *subarray = NULL;
+ char *remove_path = NULL;
int print_help = 0;
FILE *outf;
@@ -943,6 +944,9 @@ int main(int argc, char *argv[])
case O(INCREMENTAL, 'r'):
rebuild_map = 1;
continue;
+ case O(INCREMENTAL, IncrementalPath):
+ remove_path = optarg;
+ continue;
}
/* We have now processed all the valid options. Anything else is
* an error
@@ -1586,12 +1590,13 @@ int main(int argc, char *argv[])
rv = 1;
break;
}
- if (devmode == 'f') {
- rv = IncrementalRemove(devlist->devname, verbose-quiet);
- break;
- }
- rv = Incremental(devlist->devname, verbose-quiet, runstop,
- ss, homehost, require_homehost, autof);
+ if (devmode == 'f')
+ rv = IncrementalRemove(devlist->devname, remove_path,
+ verbose-quiet);
+ else
+ rv = Incremental(devlist->devname, verbose-quiet,
+ runstop, ss, homehost,
+ require_homehost, autof);
break;
case AUTODETECT:
autodetect();
diff --git a/mdadm.h b/mdadm.h
index 9d5e1c0c..c6fdebed 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -280,6 +280,7 @@ enum special_options {
DetailPlatform,
KillSubarray,
UpdateSubarray, /* 16 */
+ IncrementalPath
};
/* structures read from config file */
@@ -928,7 +929,7 @@ extern int Incremental(char *devname, int verbose, int runstop,
int autof);
extern void RebuildMap(void);
extern int IncrementalScan(int verbose);
-extern int IncrementalRemove(char *devname, int verbose);
+extern int IncrementalRemove(char *devname, char *path, int verbose);
extern int CreateBitmap(char *filename, int force, char uuid[16],
unsigned long chunksize, unsigned long daemon_sleep,
unsigned long write_behind,
diff --git a/udev-md-raid.rules b/udev-md-raid.rules
index f9607f37..a4a57ac8 100644
--- a/udev-md-raid.rules
+++ b/udev-md-raid.rules
@@ -3,7 +3,7 @@
SUBSYSTEM!="block", GOTO="md_end"
# handle potential components of arrays
-ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
+ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
# handle md arrays