diff -ur mdadm-1.0.1.orig/Assemble.c mdadm-1.0.1.lmb/Assemble.c --- mdadm-1.0.1.orig/Assemble.c Thu Mar 28 02:23:24 2002 +++ mdadm-1.0.1.lmb/Assemble.c Wed Aug 21 23:52:40 2002 @@ -250,9 +250,6 @@ devname); continue; } - if (verbose) - fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n", - devname, mddev, super.this_disk.raid_disk); devices[devcnt].devname = devname; devices[devcnt].major = MAJOR(stb.st_rdev); devices[devcnt].minor = MINOR(stb.st_rdev); @@ -260,7 +257,19 @@ devices[devcnt].oldminor = super.this_disk.minor; devices[devcnt].events = md_event(&super); devices[devcnt].utime = super.utime; - devices[devcnt].raid_disk = super.this_disk.raid_disk; + + if (super.level == -4) { + /* Workaround: In a multipath setup, all superblocks + * are identical (obviously); so they would all be + * assigned the same slot. */ + devices[devcnt].raid_disk = devcnt; + } else { + devices[devcnt].raid_disk = super.this_disk.raid_disk; + } + if (verbose) + fprintf(stderr, Name ": %s is identified as a member of %s, slot %d.\n", + devname, mddev, devices[devcnt].raid_disk); + devices[devcnt].uptodate = 0; if (most_recent < devcnt) { if (devices[devcnt].events diff -ur mdadm-1.0.1.orig/Manage.c mdadm-1.0.1.lmb/Manage.c --- mdadm-1.0.1.orig/Manage.c Mon Apr 8 01:48:36 2002 +++ mdadm-1.0.1.lmb/Manage.c Wed Aug 7 10:23:48 2002 @@ -218,6 +218,39 @@ fprintf(stderr, Name ": set %s faulty in %s\n", dv->devname, devname); break; + + case 'c': /* set clean */ + /* FIXME check current member */ + if (ioctl(fd, SET_DISK_CLEAN, (unsigned long) stb.st_rdev)) { + fprintf(stderr, Name ": set device clean failed for %s: %s\n", + dv->devname, strerror(errno)); + return 1; + } + fprintf(stderr, Name ": set %s clean in %s\n", + dv->devname, devname); + break; + + case 'A': /* activate path */ + /* FIXME check current member */ + if (ioctl(fd, SET_DISK_ACTIVE, (unsigned long) stb.st_rdev)) { + fprintf(stderr, Name ": set device active failed for %s: %s\n", + dv->devname, strerror(errno)); + return 1; + } + fprintf(stderr, Name ": set %s active in %s\n", + dv->devname, devname); + break; + + case 'I': /* deactivate path */ + /* FIXME check current member */ + if (ioctl(fd, SET_DISK_INACTIVE, (unsigned long) stb.st_rdev)) { + fprintf(stderr, Name ": set device inactive failed for %s: %s\n", + dv->devname, strerror(errno)); + return 1; + } + fprintf(stderr, Name ": set %s inactive in %s\n", + dv->devname, devname); + break; } } return 0; diff -ur mdadm-1.0.1.orig/ReadMe.c mdadm-1.0.1.lmb/ReadMe.c --- mdadm-1.0.1.orig/ReadMe.c Mon May 20 13:15:30 2002 +++ mdadm-1.0.1.lmb/ReadMe.c Wed Aug 7 10:52:58 2002 @@ -135,6 +135,9 @@ {"stop", 0, 0, 'S'}, {"readonly", 0, 0, 'o'}, {"readwrite", 0, 0, 'w'}, + {"clean", 0, 0, 24}, + {"active", 0, 0, 25}, + {"inactive", 0, 0, 26}, /* For Detail/Examine */ {"brief", 0, 0, 'b'}, @@ -349,12 +352,16 @@ "Options that are valid with management mode are:\n" " --add -a : hotadd subsequent devices to the array\n" " --remove -r : remove subsequent devices, which must not be active\n" -" --fail -f : mark subsequent devices a faulty\n" +" --fail -f : mark subsequent devices as faulty\n" " --set-faulty : same as --fail\n" " --run -R : start a partially built array\n" " --stop -S : deactive array, releasing all resources\n" " --readonly -o : mark array as readonly\n" " --readwrite -w : mark array as readwrite\n" +"For multipath:\n" +" --clean -c : mark subsequent devices as clean\n" +" --active : mark subsequent devices as active\n" +" --inactive : mark subsequent devices as inactive\n" ; char Help_misc[] = diff -ur mdadm-1.0.1.orig/md_u.h mdadm-1.0.1.lmb/md_u.h --- mdadm-1.0.1.orig/md_u.h Fri Jun 1 07:45:50 2001 +++ mdadm-1.0.1.lmb/md_u.h Wed Aug 7 10:25:30 2002 @@ -43,6 +43,11 @@ #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) +/* multi-path extensions */ +#define SET_DISK_CLEAN _IO (MD_MAJOR, 0x35) +#define SET_DISK_ACTIVE _IO (MD_MAJOR, 0x36) +#define SET_DISK_INACTIVE _IO (MD_MAJOR, 0x37) + typedef struct mdu_version_s { int major; int minor; diff -ur mdadm-1.0.1.orig/mdadm.8 mdadm-1.0.1.lmb/mdadm.8 --- mdadm-1.0.1.orig/mdadm.8 Mon May 20 12:39:40 2002 +++ mdadm-1.0.1.lmb/mdadm.8 Wed Aug 7 10:52:38 2002 @@ -275,12 +275,20 @@ be failed or spare devices. .TP -.BR -f ", " --fail +.BR -f ", " --fail ", " --set-faulty mark listed devices as faulty. .TP -.BR --set-faulty -same as --fail. +.BR --clean +mark listed devices as clean. (Only supported by multipath) + +.TP +.BR --active +mark listed devices as active. (Only supported by multipath) + +.TP +.BR --inactive +mark listed devices as inactive. (Only supported by multipath) .SH For Misc mode: diff -ur mdadm-1.0.1.orig/mdadm.c mdadm-1.0.1.lmb/mdadm.c --- mdadm-1.0.1.orig/mdadm.c Mon May 20 13:14:58 2002 +++ mdadm-1.0.1.lmb/mdadm.c Wed Aug 14 12:39:43 2002 @@ -262,7 +262,8 @@ optarg); exit(2); } - if (level != 0 && level != -1 && mode == BUILD) { + if (level != 0 && level != -1 && level != -4 + && mode == BUILD) { fprintf(stderr, Name ": Raid level %s not permitted with --build.\n", optarg); exit(2); @@ -432,6 +433,16 @@ case O(MANAGE,'f'): /* set faulty */ devmode = 'f'; continue; + case O(MANAGE,24): /* set clean */ + devmode = 'c'; + continue; + case O(MANAGE,25): /* set active */ + devmode = 'A'; + continue; + case O(MANAGE,26): /* set inactive */ + devmode = 'I'; + continue; + case O(MANAGE,'R'): case O(ASSEMBLE,'R'): case O(BUILD,'R'):