]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm-1.1.0 mdadm-1.1.0
authorNeil Brown <neilb@suse.de>
Sun, 2 Mar 2003 23:11:38 +0000 (23:11 +0000)
committerNeil Brown <neilb@suse.de>
Sun, 2 Mar 2003 23:11:38 +0000 (23:11 +0000)
17 files changed:
ANNOUNCE-1.0.0 [moved from ANNOUNCE with 100% similarity]
ANNOUNCE-1.1.0 [new file with mode: 0644]
Assemble.c
ChangeLog
Detail.c
Makefile
Monitor.c
ReadMe.c
TAGS [deleted file]
TODO
config.c
makedist
mdadm.8
mdadm.c
mdadm.h
mdadm.spec
mdadm.static [deleted file]

similarity index 100%
rename from ANNOUNCE
rename to ANNOUNCE-1.0.0
diff --git a/ANNOUNCE-1.1.0 b/ANNOUNCE-1.1.0
new file mode 100644 (file)
index 0000000..639f65d
--- /dev/null
@@ -0,0 +1,41 @@
+Subject: ANNOUNCE: mdadm 1.1.0 - A tool for managing Soft RAID under Linux
+
+
+I am pleased to announce the availability of 
+   mdadm version 1.1.0
+It is available at
+   http://www.cse.unsw.edu.au/~neilb/source/mdadm/
+and
+   http://www.{countrycode}.kernel.org/pub/utils/raid/mdadm/
+
+as a source tar-ball and (at the first site) as an SRPM, and as an RPM for i386.
+
+mdadm is a tool for creating, managing and monitoring
+device arrays using the "md" driver in Linux, also
+known as Software RAID arrays.
+
+Release 1.1.0 contains a number of spell corrections, and bug fixes.
+It has improved support for MULTIPATH arrays.
+It has some new features including:
+  --daemonise          for use with --monitor
+  --config=partitions   to find devices by examining /proc/partitions
+  --update=super-minor  to change the recorded minor-number for an array
+
+Much of the improvements are due to user feed-back.  Thanks are due to all who 
+gave suggestions and reported problems.
+
+I expect the next major release to be 2.0.0 which will include support for 
+a new super-block format soon to be supported by 2.5 series kernels.
+
+
+Development of mdadm is sponsored by CSE@UNSW: 
+  The School of Computer Science and Engineering
+at
+  The University of New South Wales
+
+NeilBrown  03/03/03
+   The third day 
+of the third month
+of the third year
+of the third millenium
+
index a2ff502390089664ca4a242ddf1b4676879652a1..4a747ca3f722b0db1546523ec698a515dcf290c3 100644 (file)
@@ -103,6 +103,7 @@ int Assemble(char *mddev, int mdfd,
                long long events;
                time_t utime;
                int uptodate;
+               int state;
                int raid_disk;
        } *devices;
        int *best; /* indexed by raid_disk */
@@ -310,6 +311,7 @@ int Assemble(char *mddev, int mdfd,
                devices[devcnt].utime = super.utime;
                devices[devcnt].raid_disk = super.this_disk.raid_disk;
                devices[devcnt].uptodate = 0;
+               devices[devcnt].state = super.this_disk.state;
                if (most_recent < devcnt) {
                        if (devices[devcnt].events
                            > devices[most_recent].events)
@@ -342,6 +344,12 @@ int Assemble(char *mddev, int mdfd,
                int j = best[i];
                int event_margin = !force;
                if (j < 0) continue;
+               /* note: we ignore error flags in multipath arrays
+                * as they don't make sense
+                */
+               if (first_super.level != -4)
+                       if (!(devices[j].state & (1<<MD_DISK_SYNC)))
+                               continue;
                if (devices[j].events+event_margin >=
                    devices[most_recent].events) {
                        devices[j].uptodate = 1;
@@ -391,7 +399,7 @@ int Assemble(char *mddev, int mdfd,
                super.events_lo = (devices[most_recent].events)&0xFFFFFFFF;
                if (super.level == 5 || super.level == 4) {
                        /* need to force clean */
-                       super.state = 0;
+                       super.state = (1<<MD_SB_CLEAN);
                }
                super.sb_csum = calc_sb_csum(&super);
 /*DRYRUN*/     if (store_super(fd, &super)) {
@@ -484,6 +492,11 @@ This doesnt work yet
                                i, mddev);
                }
        }
+       if (force && (super.level == 4 || super.level == 5) && 
+           okcnt == super.raid_disks-1) {
+               super.state = (1<< MD_SB_CLEAN);
+               change |= 2;
+       }
 
        if ((force && (change & 2))
            || (old_linux && (change & 1))) {
index bc0653f78f5131fcbfe0e3cbda4ea99ee2e1a594..49021003d070d179017043ff26c118ce31704a5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,14 @@
-Changes Prior to this release
+Changes Prior to 1.1.0 release
+    -   add --deamonise flag for --monitor - forks and prints pid to stdout
+    -   Fix bug so we REALLY clear dirty flag with -Af
+    -   -Db now prints a 'devices=' word for each array.
+    -   "mdadm -A /dev/md0" will get info from configfile, even without scan
+    -   When assembling multipath arrays, ignore devices which are flagged
+        as having errors.
+    -   take --super-minor=dev  to mean "use the minor number of the mddev 
+       being assembled.
+    -   take --config=none to mean "completely ignore config file"
+    -   Make --monitor require --scan or a device list.
 Changes Prior to 1.0.9 release
     -   Documentation updates including kernel parameters documented
        in md.4
@@ -12,13 +22,13 @@ Changes Prior to 1.0.9 release
     -   Fix printing of Gibibytes - calc was wrong.
     -   Fix printing of Array Size in --detail when very big.
     -   --monitor no longer tries to work for raid0 or linear as these
-       have nothing to be monitors.
+       have nothing to be monitored.
     -   The word 'partitions' on a DEVICE line will cause all partitions
        listed in /proc/partitions to be considered
     -   If the config file is called 'partitions' then it will be treated
         as though it contained exactly 'device partitions' so e.g.
          mdadm -Ebsc partitions
-       will fill all raid partitions easily.   
+       will find all raid partitions easily.   
     -  successfully assemble multipath devices by ignoring raid_disk
        value from superblock (it is always the same).
     -   --assemble not tied to MD_SB_DISKS limit quite so much
index e675eda7cd35cedc6fdd1a41c2dd902d9c26a8cf..180a6648b49dcd566e0b85a59d01fafc79d4d4cb 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -44,6 +44,7 @@ int Detail(char *dev, int brief)
        int d;
        time_t atime;
        char *c;
+       char *devices = NULL;
 
        mdp_super_t super;
        int have_super = 0;
@@ -163,7 +164,15 @@ int Detail(char *dev, int brief)
                        if (disk.state & (1<<MD_DISK_REMOVED)) printf(" removed");
                }
                if ((dv=map_dev(disk.major, disk.minor))) {
-                       if (!brief) printf("   %s", dv);
+                       if (brief) {
+                               if (devices) {
+                                       devices = realloc(devices,
+                                                         strlen(devices)+1+strlen(dv)+1);
+                                       strcat(strcat(devices,","),dv);
+                               } else
+                                       devices = strdup(dv);
+                       } else
+                               printf("   %s", dv);
                        if (!have_super && (disk.state & (1<<MD_DISK_ACTIVE))) {
                                /* try to read the superblock from this device
                                 * to get more info
@@ -189,6 +198,7 @@ int Detail(char *dev, int brief)
                if (!brief) 
                        printf("\n         Events : %d.%d\n", super.events_hi, super.events_lo);
        }
+       if (brief && devices) printf("\n   devices=%s", devices);
        if (brief) printf("\n");
        return 0;
 }
index 82efc4cb336c0516ae09d49cf5a2faa0617b381b..9fb83ed946e1d4b54362376d1a6c768b995ba132 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,9 @@ MAN4DIR = $(MANDIR)/man4
 MAN5DIR = $(MANDIR)/man5
 MAN8DIR = $(MANDIR)/man8
 
+
+KLIBC=/home/src/klibc/klibc-0.77
+
 OBJS =  mdadm.o config.o mdstat.o  ReadMe.o util.o Manage.o Assemble.o Build.o Create.o Detail.o Examine.o Monitor.o dlink.o Kill.o Query.o
 SRCS =  mdadm.c config.c mdstat.c  ReadMe.c util.c Manage.c Assemble.c Build.c Create.c Detail.c Examine.c Monitor.c dlink.c Kill.c Query.c
 
@@ -69,6 +72,10 @@ mdadm.tcc : $(SRCS) mdadm.h
 mdadm.uclibc : $(SRCS) mdadm.h
        $(UCLIBC_GCC) -DUCLIBC -o mdadm.uclibc $(SRCS)
 
+mdadm.klibc : $(SRCS) mdadm.h
+       rm -f $(OBJS) 
+       gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32 $(CFLAGS) $(SRCS)
+
 mdadm.man : mdadm.8
        nroff -man mdadm.8 > mdadm.man
 
@@ -87,7 +94,7 @@ install : mdadm mdadm.8 md.4 mdadm.conf.5
        $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
 
 clean : 
-       rm -f mdadm $(OBJS) core *.man mdadm.tcc mdadm.uclibc
+       rm -f mdadm $(OBJS) core *.man mdadm.tcc mdadm.uclibc mdadm.static
 
 dist : clean
        ./makedist
index d994dbe95445d0e694a1196ae35e49b136b4a2e8..282593c69f89c3db6b0e4997019dbce8ac814d15 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -45,7 +45,7 @@ static char *percentalerts[] = {
 
 int Monitor(mddev_dev_t devlist,
            char *mailaddr, char *alert_cmd,
-           int period, int scan,
+           int period, int daemonise, int scan,
            char *config)
 {
        /*
@@ -105,12 +105,37 @@ int Monitor(mddev_dev_t devlist,
        int finished = 0;
        struct mdstat_ent *mdstat = NULL;
 
-       if (!mailaddr && scan)
+       if (!mailaddr) {
                mailaddr = conf_get_mailaddr(config);
-       if (!alert_cmd && scan)
+               if (mailaddr && ! scan)
+                       printf("mdadm: Monitor using email address \"%s\" from config file\n",
+                              mailaddr);
+       }
+       if (!alert_cmd) {
                alert_cmd = conf_get_program(config);
+               if (alert_cmd && ! scan)
+                       printf("mdadm: Monitor using program \"%s\" from config file\n",
+                              alert_cmd);
+       }
        if (scan && !mailaddr && !alert_cmd)
-               return 0;
+               return 1;
+
+       if (daemonise) {
+               int pid = fork();
+               if (pid > 0) {
+                       printf("%d\n", pid);
+                       return 0;
+               }
+               if (pid < 0) {
+                       perror("daemonise");
+                       return 1;
+               }
+               close(0);
+               open("/dev/null", 3);
+               dup2(0,1);
+               dup2(0,2);
+               setsid();
+       }
 
        if (devlist == NULL) {
                mddev_ident_t mdlist = conf_get_ident(config, NULL);
@@ -121,7 +146,7 @@ int Monitor(mddev_dev_t devlist,
                        st->devname = strdup(mdlist->devname);
                        st->utime = 0;
                        st->next = statelist;
-                       st->err = 1;
+                       st->err = 0;
                        st->devnum = -1;
                        st->percent = -2;
                        if (mdlist->spare_group)
@@ -139,7 +164,7 @@ int Monitor(mddev_dev_t devlist,
                        st->devname = strdup(dv->devname);
                        st->utime = 0;
                        st->next = statelist;
-                       st->err = 1;
+                       st->err = 0;
                        st->devnum = -1;
                        st->percent = -2;
                        st->spare_group = NULL;
index 390fee43045731a07a986e88769bb5003b088ae1..3ba1e01c470978aed2274a3753acaf729fea854c 100644 (file)
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -29,7 +29,7 @@
 
 #include "mdadm.h"
 
-char Version[] = Name " - v1.0.9 - 12 Feb 2003\n";
+char Version[] = Name " - v1.1.0 - 3 Mar 2003\n";
 /*
  * File: ReadMe.c
  *
@@ -146,6 +146,8 @@ struct option long_options[] = {
     {"program",   1, 0, 'p'},
     {"alert",     1, 0, 'p'},
     {"delay",     1, 0, 'd'},
+    {"daemonise", 1, 0, 'f'},
+    {"daemonize", 1, 0, 'f'},
     
     
     {0, 0, 0, 0}
@@ -398,6 +400,7 @@ char Help_monitor[] =
 "  --delay=      -d   : seconds of delay between polling state. default=60\n"
 "  --config=     -c   : specify a different config file\n"
 "  --scan        -s   : find mail-address/program in config file\n"
+"  --daemonise   -f   : Fork and continue in child, parent exits\n"
 ;
 
 
diff --git a/TAGS b/TAGS
deleted file mode 100644 (file)
index a7e975c..0000000
--- a/TAGS
+++ /dev/null
@@ -1,260 +0,0 @@
-\f
-Assemble.c,22
-int Assemble(\7f34,1176
-\f
-Build.c,100
-#define REGISTER_DEV \7f32,1140
-#define START_MD \7f33,1181
-#define STOP_MD \7f34,1222
-int Build(\7f36,1264
-\f
-COPYING,99
-program will \7fwill\ 152,2561
-program proprietary.\7fproprietary\ 153,2632
-PROGRAM PROVE \7fPROVE\ 1267,14397
-\f
-ChangeLog,294
-    -   When --assemble --force,\7f13,443
-    -   When marking drives as not-failed in the superblock,\7f16,627
-       are passed as unsigned lock,\7f23,1044
-    -   If HOT_ADD_DISK failes for -a,\7f24,1100
-       if we cannot read from the array,\7f25,1166
-       and mdctl.conf compatible description with uuid=\7f31,1443
-\f
-Create.c,20
-int Create(\7f34,1176
-\f
-Detail.c,20
-int Detail(\7f34,1176
-\f
-Examine.c,21
-int Examine(\7f38,1285
-\f
-Kill.c,18
-int Kill(\7f37,1237
-\f
-Makefile,12
-CC \7f30,1091
-\f
-Manage.c,161
-#define REGISTER_DEV \7f34,1176
-#define START_MD \7f35,1217
-#define STOP_MD \7f36,1258
-int Manage_ro(\7f38,1300
-int Manage_runstop(\7f75,2154
-int Manage_subdevs(\7f118,3161
-\f
-Monitor.c,49
-int Monitor(\7f37,1283
-static void alert(\7f175,4727
-\f
-ReadMe.c,266
-char Version[\7f32,1140
-char short_options[\7f81,3226
-struct option long_options[\7f82,3290
-char Usage[\7f140,4885
-char Help[\7f145,4942
-char Help_create[\7f218,8393
-char Help_build[\7f245,9615
-char Help_assemble[\7f258,10155
-mapping_t r5layout[\7f317,13101
-mapping_t pers[\7f331,13317
-\f
-TODO,590
-* write proc.c to parse /proc/mdstat file,\7f5,65
-   Build list of arrays:  name,\7f6,140
-* --detail --scan to read mdctl.conf,\7f8,189
-* --detail --scan to read mdctl.conf, and then iterate over these,\7f8,189
-- set md_minor,\7f34,933
-- for create raid5,\7f35,976
-   all working,\7f36,1019
-   one missing,\7f37,1050
-   one missing, one spare,\7f37,1050
-- when RUN_ARRAY,\7f40,1152
-- get --detail to extract extra stuff from superblock,\7f42,1206
-- when --assemble --scan,\7f48,1368
-- when --assemble --scan, if an underlying device is an md device,\7f48,1368
-ARRAY lines in config file to have super_minor=\7f62,1797
-\f
-config.c,479
-char DefaultConfFile[\7f68,2401
-char *keywords[\7f70,2446
-int match_keyword(\7f77,2645
-char *conf_word(\7f97,3153
-char *conf_line(\7f163,4744
-void free_line(\7f184,5046
-struct conf_dev \7fconf_dev\ 1195,5188
-} *cdevlist \7f198,5249
-int devline(\7f202,5272
-mddev_ident_t mddevlist \7f220,5595
-mddev_ident_t *mddevlp \7f221,5627
-void arrayline(\7f223,5665
-int loaded \7f303,7978
-void load_conffile(\7f305,7995
-mddev_ident_t conf_get_ident(\7f338,8486
-mddev_dev_t conf_get_devs(\7f348,8688
-int match_oneof(\7f383,9316
-\f
-dlink.c,177
-void *dl_head(\7f11,180
-void dl_free(\7f20,289
-void dl_init(\7f26,363
-void dl_insert(\7f32,430
-void dl_add(\7f40,598
-void dl_del(\7f48,763
-char *dl_strndup(\7f57,969
-char *dl_strdup(\7f73,1176
-\f
-dlink.h,193
-struct __dl_head\7f__dl_head\ 15,100
-#define        dl_alloc(\7fdl_alloc\ 111,187
-#define        dl_new(\7fdl_new\ 112,297
-#define        dl_newv(\7fdl_newv\ 113,341
-#define dl_next(\7fdl_next\ 115,391
-#define dl_prev(\7fdl_prev\ 116,461
-\f
-makedist,127
-target=\7f3,11
-( cd .. ; ln -s mdctl mdctl-$version \7f19,352
-( cd .. ; ln -s mdctl mdctl-$version ; tar czhvf - --exclude=\7f19,352
-\f
-md_p.h,1316
-#define _MD_P_H\7f16,582
-#define MD_RESERVED_BYTES      \7f44,1414
-#define MD_RESERVED_SECTORS    \7f45,1453
-#define MD_RESERVED_BLOCKS     \7f46,1508
-#define MD_NEW_SIZE_SECTORS(\7fMD_NEW_SIZE_SECTORS\ 148,1570
-#define MD_NEW_SIZE_BLOCKS(\7fMD_NEW_SIZE_BLOCKS\ 149,1659
-#define MD_SB_BYTES    \7f51,1746
-#define MD_SB_WORDS    \7f52,1773
-#define MD_SB_BLOCKS   \7f53,1813
-#define MD_SB_SECTORS  \7f54,1863
-#define        MD_SB_GENERIC_OFFSET    \7f59,1960
-#define MD_SB_PERSONALITY_OFFSET       \7f60,1992
-#define MD_SB_DISKS_OFFSET     \7f61,2028
-#define MD_SB_DESCRIPTOR_OFFSET        \7f62,2060
-#define MD_SB_GENERIC_CONSTANT_WORDS   \7f64,2098
-#define MD_SB_GENERIC_STATE_WORDS      \7f65,2138
-#define MD_SB_GENERIC_WORDS    \7f66,2175
-#define MD_SB_PERSONALITY_WORDS        \7f67,2263
-#define MD_SB_DESCRIPTOR_WORDS \7f68,2299
-#define MD_SB_DISKS    \7f69,2334
-#define MD_SB_DISKS_WORDS      \7f70,2359
-#define MD_SB_RESERVED_WORDS   \7f71,2423
-#define MD_SB_EQUAL_WORDS      \7f72,2553
-#define MD_DISK_FAULTY \7f77,2691
-#define MD_DISK_ACTIVE \7f78,2752
-#define MD_DISK_SYNC   \7f79,2814
-#define MD_DISK_REMOVED        \7f80,2878
-typedef struct mdp_device_descriptor_s \7fmdp_device_descriptor_s\ 182,2946
-} mdp_disk_t;\7fmdp_disk_t\ 189,3310
-#define MD_SB_MAGIC    \7f91,3325
-#define MD_SB_CLEAN    \7f96,3390
-#define MD_SB_ERRORS   \7f97,3413
-typedef struct mdp_superblock_s \7fmdp_superblock_s\ 199,3438
-} mdp_super_t;\7fmdp_super_t\ 1164,5835
-static inline __u64 md_event(\7f166,5851
-\f
-md_u.h,1118
-#define _MD_U_H\7f16,590
-#define RAID_VERSION   \7f21,634
-#define GET_ARRAY_INFO \7f22,693
-#define GET_DISK_INFO  \7f23,757
-#define PRINT_RAID_DEBUG       \7f24,819
-#define RAID_AUTORUN   \7f25,865
-#define CLEAR_ARRAY    \7f28,929
-#define ADD_NEW_DISK   \7f29,971
-#define HOT_REMOVE_DISK        \7f30,1032
-#define SET_ARRAY_INFO \7f31,1078
-#define SET_DISK_INFO  \7f32,1142
-#define WRITE_RAID_INFO        \7f33,1186
-#define UNPROTECT_ARRAY        \7f34,1232
-#define PROTECT_ARRAY  \7f35,1278
-#define HOT_ADD_DISK   \7f36,1322
-#define SET_DISK_FAULTY        \7f37,1365
-#define RUN_ARRAY      \7f40,1424
-#define START_ARRAY    \7f41,1478
-#define STOP_ARRAY     \7f42,1520
-#define STOP_ARRAY_RO  \7f43,1561
-#define RESTART_ARRAY_RW       \7f44,1605
-typedef struct mdu_version_s \7fmdu_version_s\ 146,1652
-} mdu_version_t;\7fmdu_version_t\ 150,1724
-typedef struct mdu_array_info_s \7fmdu_array_info_s\ 152,1742
-} mdu_array_info_t;\7fmdu_array_info_t\ 183,2516
-typedef struct mdu_disk_info_s \7fmdu_disk_info_s\ 185,2537
-} mdu_disk_info_t;\7fmdu_disk_info_t\ 195,2693
-typedef struct mdu_start_info_s \7fmdu_start_info_s\ 197,2713
-} mdu_start_info_t;\7fmdu_start_info_t\ 1106,2857
-typedef struct mdu_param_s\7fmdu_param_s\ 1108,2878
-} mdu_param_t;\7fmdu_param_t\ 1113,3014
-\f
-mdctl.8,252
-real block devices. This allows multiple devices \7f14,241
-{left,right}-{,a}symmetric,\7f185,4006
-{left,right}-{,a}symmetric, la,\7f185,4006
-{left,right}-{,a}symmetric, la, ra,\7f185,4006
-{left,right}-{,a}symmetric, la, ra, ls,\7f185,4006
-.BR --layout=\7f188,4087
-\f
-mdctl.c,64
-int open_mddev(\7f33,1158
-int main(\7f50,1477
-#define O(\7fO\ 1177,4288
-\f
-mdctl.h,855
-#define        __USE_LARGEFILE64\7f30,1120
-#define        MD_MAJOR \7f47,1496
-#define Name \7f52,1536
-extern char short_options[\7f54,1558
-extern struct option long_options[\7f55,1587
-extern char Version[\7f56,1624
-extern char Version[], Usage[\7f56,1624
-extern char Version[], Usage[], Help[\7f56,1624
-extern char Version[], Usage[], Help[], Help_create[\7f56,1624
-extern char Version[], Usage[], Help[], Help_create[], Help_build[\7f56,1624
-extern char Version[], Usage[], Help[], Help_create[], Help_build[], Help_assemble[\7f56,1624
-typedef struct mddev_ident_s \7fmddev_ident_s\ 168,2060
-} *mddev_ident_t;\7fmddev_ident_t\ 183,2389
-typedef struct mddev_dev_s \7fmddev_dev_s\ 186,2456
-} *mddev_dev_t;\7fmddev_dev_t\ 192,2644
-typedef struct mapping \7fmapping\ 194,2661
-} mapping_t;\7fmapping_t\ 197,2709
-#define Sendmail \7f100,2740
-extern mapping_t r5layout[\7f105,2884
-extern mapping_t r5layout[], pers[\7f105,2884
-\f
-mdctl.spec,235
-Summary: mdctl is used for controlling Linux md devices \7f1,0
-option of using a configuration file,\7f18,630
-raidtools uses a configuration file to describe how to create a RAID array,\7f21,718
-Further,\7f23,871
-stopping a raid array,\7f24,941
-\f
-raid5extend.c,39
-int phys2log(\7f2,1
-raid5_extend(\7f46,902
-\f
-util.c,600
-int parse_uuid(\7f40,1359
-int md_get_version(\7f82,2122
-int get_linux_version(\7f101,2481
-int enough(\7f113,2678
-int same_uuid(\7f129,2928
-void uuid_from_super(\7f139,3057
-int compare_super(\7f153,3334
-int load_super(\7f187,4297
-int store_super(\7f227,4955
-int check_ext2(\7f253,5326
-int check_reiser(\7f284,6089
-int check_raid(\7f308,6645
-int ask(\7f324,7008
-char *map_num(\7f344,7373
-int map_name(\7f354,7508
-struct devmap \7fdevmap\ 1369,7837
-} *devlist \7f373,7916
-int devlist_ready \7f374,7935
-#define  __USE_XOPEN_EXTENDED\7f376,7959
-int add_dev(\7f380,8008
-char *map_dev(\7f396,8375
-int calc_sb_csum(\7f412,8650
-char *human_size(\7f428,9046
diff --git a/TODO b/TODO
index 3cafb8c9a9608bdcbf9073d6269b83c7638db774..feb8a11a7c638ccb16599711d5777cf0f614b622 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,13 @@
-* --assemble could have a --update option.
+* maybe "missing" instead of <bold>missing</> in doco DONE
+* possibly wait for resync to start, or even finish while assembling.- NO
+
+* -Db should have a devices= entry if possible. - DONE
+* when assembling multipath arrays, ignore any error indicators. - DONE
+* rationalise --monitor usage:
+     mdadm --monitor
+  doesn't do as expected. DONE
+
+* --assemble could have a --update option. - DONE
   following word can be:
        sparc2.2
        super-minor
index 1f2524496fd7e6a8b039f75bbbb29d6d47bbbada..68b453c46e0a9a55b89f3f78aefc3be18f186c66 100644 (file)
--- a/config.c
+++ b/config.c
@@ -379,8 +379,13 @@ void load_conffile(char *conffile)
        if (conffile == NULL)
                conffile = DefaultConfFile;
 
+       if (strcmp(conffile, "none") == 0) {
+               loaded = 1;
+               return;
+       }
        if (strcmp(conffile, "partitions")==0) {
                load_partitions();
+               loaded = 1;
                return;
        }
        f = fopen(conffile, "r");
index 7ead17afc097691e82d1bc38037012d776ddca64..8b01af9caec9b4a9e9245873f36c5b1d8b5aa613 100755 (executable)
--- a/makedist
+++ b/makedist
@@ -21,7 +21,7 @@ then
   exit 1
 fi
 trap "rm $target/$base; exit" 1 2 3
-( cd .. ; ln -s mdadm mdadm-$version ; tar chvf - --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
+( cd .. ; ln -s mdadm mdadm-$version ; tar chvf - --exclude="TAGS" --exclude='*,v' --exclude='*.o' --exclude mdadm --exclude=mdadm'.[^ch0-9]' --exclude=RCS mdadm-$version ; rm mdadm-$version ) | gzip --best > $target/$base
 chmod a+r $target/$base
 ls -l $target/$base
 
diff --git a/mdadm.8 b/mdadm.8
index c25dd7d3ace9a78909813e5a8f4e2380d3fb7a54..5511aeccf46589a3f097026ddefc4836e57835ad 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH MDADM 8
+.TH MDADM 8 "" v1.1.0
 .SH NAME
 mdadm \- manage MD devices
 .I aka
@@ -27,14 +27,16 @@ md devices,
 (striping),
 .B RAID1
 (mirroring),
-.B RAID4
+.BR RAID4 ,
+.BR RAID5 ,
 and
-.B RAID5.
-
-Recent kernels (2002) also support a mode known as
 .BR MULTIPATH .
-.B mdadm
-only provides limited support for MULTIPATH as yet.
+
+.B MULTIPATH is not a Software RAID mechanism, but does involve
+multiple devices.  For
+.B MULTIPATH
+each device is a path to one common physical storage device.
+
 
 .B mdadm
 is a program that can be used to create, manage, and monitor
@@ -186,6 +188,11 @@ will act as though the config file contained exactly
 and will read
 .B /proc/partitions
 to find a list of devices to scan.
+If the word
+.B none
+is given for the config file, then
+.I mdadm
+will act as though the config file were empty.
 
 .TP
 .BR -s ", " --scan
@@ -241,9 +248,8 @@ same as --parity
 Specify the number of active devices in the array.  This, plus the
 number of spare devices (see below) must equal the number of
 .I component-devices
-(including
-.B missing 
-devices) that are listed on the command line.
+(including "\fBmissing\fP" devices)
+that are listed on the command line.
 
 .TP
 .BR -x ", " --spare-devices=
@@ -278,6 +284,16 @@ don't have this minor number are excluded.  If you create an array as
 /dev/md1, then all superblocks will contain the minor number 1, even if
 the array is later assembled as /dev/md2.
 
+Giving the literal word "dev" for
+.B --super-minor
+will cause
+.I mdadm
+to use the minor number of the md device that is being assembled.
+e.g. when assembling
+.BR /dev/md0 ,
+.M --super-minor=dev
+will look for super blocks with a minor number of 0.
+
 .TP
 .BR -f ", " --force
 Assemble the array even if some superblocks appear out-of-date
@@ -395,6 +411,18 @@ Give a delay in seconds.
 polls the md arrays and then waits this many seconds before polling
 again.  The default is 60 seconds.
 
+.TP
+.BR -f ", " --daemonise
+Tell
+.B mdadm
+to run as a background daemon if it decides to monitor anything.  This
+causes it to fork and run in the child, and to disconnect form the
+terminal.  The process id of the child is written to stdout.
+This is useful with
+.B --scan
+which will only continue monitoring if a mail address or alert program
+is found in the config file.
+
 .SH ASSEMBLE MODE
 
 .HP 12
@@ -423,6 +451,14 @@ devices and assembly is attempted.
 In the third (where no devices are listed) all md devices that are
 listed in the configuration file are assembled.
 
+If precisely one device is listed, but
+.B --scan
+is not given, that
+.I mdadm
+acts as though
+.B --scan
+was given and identify information is extracted from the configuration file.
+
 The identity can be given with the 
 .B --uuid
 option, with the
@@ -438,7 +474,7 @@ any array.
 
 The config file is only used if explicitly named with 
 .B --config
-or requested with 
+or requested with (a possibly implicit)
 .B --scan. 
 In the later case,
 .B /etc/mdadm.conf
@@ -507,16 +543,15 @@ the presence of a
 can override this caution.
 
 To create a "degraded" array in which some devices are missing, simply
-give the word
-.B missing
+give the word "\fBmissing\fP"
 in place of a device name.  This will cause
 .B mdadm
 to leave the corresponding slot in the array empty.
 For a RAID4 or RAID5 array at most one slot can be
-.BR missing .
+"\fBmissing\fP".
 For a RAID1 array, only one real device needs to be given.  All of the
 others can be
-.BR missing .
+"\fBmissing\fP".
 
 '''If the 
 '''.B --size
@@ -851,6 +886,13 @@ and assemble
 .B /dev/md0
 out of all such devices with a RAID superblock with a minor number of 0.
 
+.B "  mdadm --monitor --scan --daemonise > /var/run/mdadm"
+.br
+If config file contains a mail address or alert program, run mdadm in
+the background in monitor mode monitoring all md devices.  Also write
+pid of mdadm daemon to
+.BR /var/run/mdadm .
+
 .B "  mdadm --create --help"
 .br
 Providew help about the Create mode.
diff --git a/mdadm.c b/mdadm.c
index c43737870937609e0347061727445a039b2fcae1..d86d1a5bf5095d3f63871fd7bfb4645ebd80a55f 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -82,6 +82,7 @@ int main(int argc, char *argv[])
        char *mailaddr = NULL;
        char *program = NULL;
        int delay = 0;
+       int daemonise = 0;
 
        int mdfd = -1;
 
@@ -358,15 +359,19 @@ int main(int argc, char *argv[])
                        continue;
 
                case O(ASSEMBLE,'m'): /* super-minor for array */
-                       if (ident.super_minor >= 0) {
+                       if (ident.super_minor != -1) {
                                fprintf(stderr, Name ": super-minor cannot be set twice.  "
                                        "Second value: %s.\n", optarg);
                                exit(2);
                        }
-                       ident.super_minor = strtoul(optarg, &cp, 10);
-                       if (!optarg[0] || *cp) {
-                               fprintf(stderr, Name ": Bad super-minor number: %s.\n", optarg);
-                               exit(2);
+                       if (strcmp(optarg, "dev")==0)
+                               ident.super_minor = -2;
+                       else {
+                               ident.super_minor = strtoul(optarg, &cp, 10);
+                               if (!optarg[0] || *cp) {
+                                       fprintf(stderr, Name ": Bad super-minor number: %s.\n", optarg);
+                                       exit(2);
+                               }
                        }
                        continue;
 
@@ -429,6 +434,9 @@ int main(int argc, char *argv[])
                                }
                        }
                        continue;
+               case O(MONITOR,'f'): /* daemonise */
+                       daemonise = 1;
+                       continue;
                        
 
                        /* now the general management options.  Some are applicable
@@ -535,6 +543,11 @@ int main(int argc, char *argv[])
                mdfd = open_mddev(devlist->devname);
                if (mdfd < 0)
                        exit(1);
+               if (ident.super_minor == -2) {
+                       struct stat stb;
+                       fstat(mdfd, &stb);
+                       ident.super_minor = MINOR(stb.st_rdev);
+               }
        }
 
        rv = 0;
@@ -552,7 +565,25 @@ int main(int argc, char *argv[])
                        rv = Manage_runstop(devlist->devname, mdfd, runstop);
                break;
        case ASSEMBLE:
-               if (!scan)
+               if (devs_found == 1 && ident.uuid_set == 0 &&
+                   ident.super_minor == -1 && !scan ) {
+                       /* Only a device has been given, so get details from config file */
+                       mddev_ident_t array_ident = conf_get_ident(configfile, devlist->devname);
+                       mdfd = open_mddev(devlist->devname);
+                       if (mdfd < 0)
+                               rv |= 1;
+                       else {
+                               if (array_ident == NULL) {
+                                       fprintf(stderr, Name ": %s not identified in config file.\n",
+                                               devlist->devname);
+                                       rv |= 1;
+                               }
+                               else 
+                                       rv |= Assemble(devlist->devname, mdfd, array_ident, configfile,
+                                                      NULL,
+                                                      readonly, runstop, update, verbose, force);
+                       }
+               } else if (!scan)
                        rv = Assemble(devlist->devname, mdfd, &ident, configfile,
                                      devlist->next,
                                      readonly, runstop, update, verbose, force);
@@ -676,14 +707,13 @@ int main(int argc, char *argv[])
                }
                break;
        case MONITOR:
-/*
                if (!devlist && !scan) {
                        fprintf(stderr, Name ": Cannot monitor: need --scan or at least one device\n");
                        rv = 1;
                        break;
                }
-*/             rv= Monitor(devlist, mailaddr, program,
-                           delay?delay:60, scan, configfile);
+               rv= Monitor(devlist, mailaddr, program,
+                           delay?delay:60, daemonise, scan, configfile);
                break;
        }
        exit(rv);
diff --git a/mdadm.h b/mdadm.h
index 2f813c1fe999621ad6ab5697b6fe0843fb46185c..37a23fcf7f468aa569ff826da98eb846239afc9e 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -168,7 +168,7 @@ extern int Query(char *dev);
 extern int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust);
 extern int Monitor(mddev_dev_t devlist,
                   char *mailaddr, char *alert_cmd,
-                  int period, int scan,
+                  int period, int daemonise, int scan,
                   char *config);
 
 extern int Kill(char *dev, int force);
index 0657c76871ab5d8401b416ca6400a4376cc3f508..a88c62890ae94e6512db8aebc10ad2b0fa4b0254 100644 (file)
@@ -1,6 +1,6 @@
 Summary:     mdadm is used for controlling Linux md devices (aka RAID arrays)
 Name:        mdadm
-Version:     1.0.9
+Version:     1.1.0
 Release:     1
 Source:      http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
 URL:         http://www.cse.unsw.edu.au/~neilb/source/mdadm/
diff --git a/mdadm.static b/mdadm.static
deleted file mode 100755 (executable)
index cd31ad7..0000000
Binary files a/mdadm.static and /dev/null differ