* 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);
/* For Incremental */
{"rebuild-map", 0, 0, 'r'},
+ {"path", 1, 0, IncrementalPath},
+
{0, 0, 0, 0}
};
int rebuild_map = 0;
int auto_update_home = 0;
char *subarray = NULL;
+ char *remove_path = NULL;
int print_help = 0;
FILE *outf;
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
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();
DetailPlatform,
KillSubarray,
UpdateSubarray, /* 16 */
+ IncrementalPath
};
/* structures read from config file */
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,
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