]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Release 2.5 mdadm-2.5
authorNeil Brown <neilb@suse.de>
Fri, 26 May 2006 07:12:48 +0000 (07:12 +0000)
committerNeil Brown <neilb@suse.de>
Fri, 26 May 2006 07:12:48 +0000 (07:12 +0000)
Signed-off-by: Neil Brown <neilb@suse.de>
14 files changed:
ANNOUNCE-2.5 [new file with mode: 0644]
Assemble.c
ChangeLog
ReadMe.c
inventory
mdadm.8
mdadm.c
mdadm.conf.5
mdadm.spec
mdassemble.8
super1.c
test
tests/05r1-internalbitmap
tests/05r1-n3-bitmapfile

diff --git a/ANNOUNCE-2.5 b/ANNOUNCE-2.5
new file mode 100644 (file)
index 0000000..8515015
--- /dev/null
@@ -0,0 +1,67 @@
+Subject:  ANNOUNCE: mdadm 2.5 - A tool for managing Soft RAID under Linux
+
+I am pleased to announce the availability of
+   mdadm version 2.5
+
+It is available at the usual places:
+   http://www.cse.unsw.edu.au/~neilb/source/mdadm/
+and
+   http://www.{countrycode}.kernel.org/pub/linux/utils/raid/mdadm/
+
+mdadm is a tool for creating, managing and monitoring
+device arrays using the "md" driver in Linux, also
+known as Software RAID arrays.
+
+Release 2.5 adds a host of minor updates and one major update.
+
+The major update involves an "Auto Assemble" function which will,
+with certainly limits, scan all available devices for anything that
+looks like an md array, and will try to assemble it.
+This code should be treated with some caution as it is very new,
+and could be revised in future, though hopefully not very much.
+
+The main problem I have always had will auto-assembly is that it
+is too easy for it to assemble thing that you don't want assembled,
+e.g. if you have moved some devices from a different computer.
+To remove this problem, arrays can now be tagged for the computer
+that is their home (homehost) and only arrays with the correct
+homehost will be auto-assembled.
+
+Feedback on the effectiveness and usefulness of this feature and it's
+documentation is encouraged.
+
+Changelog Entries:
+    -   Support 'mailfrom' line in mdadm.conf so the From: line in alert
+       emails can be explicitly set.
+    -   Arrange that SparesMissing (which is similar in import to
+       DegradedArray) generates an Email.
+    -   Assume "DEVICE partitions" if no DEVICE line is given.
+    -   Support new 'offset' layout for raid10.
+    -   When creating a bitmap file, choose a chunksize to limit number
+       of bitmap chunks to 2 million.  More than this can cause kmalloc
+       failure.
+    -   New 'CREATE' line in mdadm.conf for defaults such as owner, group,
+       mode and auto-flag
+    -   --detail checks if array has been started or not and includes that
+       in report.
+    -   When using --update=uuid on an array with a bitmap, update the
+       bitmap's uuid too.
+    -   Add a copy of /proc/mdstat to the mail message sent by mdadm
+        --monitor.
+    -   New flag --no-degraded to avoid starting arrays if there are
+       fewer devices available than last time the array was started.
+       This is only needed with --scan, as with --scan, that behaviour
+       is the default.
+    -   Support for 'homehost' concept.  This is a fairly major update.
+       It includes a configfile option and a command line option for
+       specifying a homehost, records that host in the superblock,
+       and reports the homehost where possible.
+    -   Support for Auto Assembly.  "mdadm -As" will, if provided with
+       the name of a homehost, try to assemble all arrays it can find
+       that were created for that homehost.  See man pages for more details.
+
+Development of mdadm is sponsored by
+ SUSE Labs, Novell Inc.
+
+NeilBrown  26th May 2006
+
index 75da9a50dc641b7cab0492b2e5d88675d877451b..816a88e0f797c1784af805903aa0f0559b2b41ae 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include       "mdadm.h"
+#include       <ctype.h>
 
 static int name_matches(char *found, char *required, char *homehost)
 {
@@ -112,7 +113,7 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
         */
        int must_close = 0;
        int old_linux = 0;
-       int vers;
+       int vers = 0; /* Keep gcc quite - it really is initialised */
        void *first_super = NULL, *super = NULL;
        struct {
                char *devname;
@@ -376,7 +377,11 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                st->ss->getinfo_super(&info, first_super);
                c = strchr(info.name, ':');
                if (c) c++; else c= info.name;
-               asprintf(&mddev, "/dev/md/%s", c);
+               if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6))
+                       /* /dev/md/d0 style for partitionable */
+                       asprintf(&mddev, "/dev/md/d%s", c);
+               else
+                       asprintf(&mddev, "/dev/md/%s", c);
                mdfd = open_mddev(mddev, ident->autof);
                if (mdfd < 0)
                        return mdfd;
index 59bd12121875c421dffabfa998dc4ba75c636bde..91151eea3533dcd1fe9dcbf9bfe967f4277225bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,12 +14,19 @@ Changes Prior to this release
        in report.
     -   When using --update=uuid on an array with a bitmap, update the
        bitmap's uuid too.
-    -   Add a copy of /proc/mdstat to the mail message send by mdadm
+    -   Add a copy of /proc/mdstat to the mail message sent by mdadm
         --monitor.
     -   New flag --no-degraded to avoid starting arrays if there are
        fewer devices available than last time the array was started.
        This is only needed with --scan, as with --scan, that behaviour
        is the default.
+    -   Support for 'homehost' concept.  This is a fairly major update.
+       It includes a configfile option and a command line option for
+       specifying a homehost, records that host in the superblock,
+       and reports the homehost where possible.
+    -   Support for Auto Assembly.  "mdadm -As" will, if provided with
+       the name of a homehost, try to assemble all arrays it can find
+       that were created for that homehost.  See man pages for more details.
 
 Changes Prior to 2.4.1 release
     -   Honour --write-mostly when adding to an array without persistent
index b6284ab28431e6bb968dee53e745816b6bf25738..e259e8806f45cf8a9ec0631315bc60f1893d71ad 100644 (file)
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -29,7 +29,7 @@
 
 #include "mdadm.h"
 
-char Version[] = Name " - v2.4.1 -  4 April 2006\n";
+char Version[] = Name " - v2.5 -  26 May 2006\n";
 
 /*
  * File: ReadMe.c
index 65275b6a6bda06080855c3d23ee8c9457908d589..186c1e0905c4ec4057cde58b55b56bbae9626544 100644 (file)
--- a/inventory
+++ b/inventory
@@ -7,6 +7,7 @@ ANNOUNCE-2.3.1
 ANNOUNCE-2.4
 ANNOUNCE-2.4-pre1
 ANNOUNCE-2.4.1
+ANNOUNCE-2.5
 Assemble.c
 Build.c
 COPYING
@@ -23,6 +24,7 @@ Monitor.c
 Query.c
 README.initramfs
 ReadMe.c
+SHA1.c
 TODO
 bitmap.c
 bitmap.h
@@ -32,6 +34,7 @@ dlink.h
 inventory
 makedist
 md.4
+md5.h
 md_p.h
 md_u.h
 mdadm.8
@@ -49,6 +52,8 @@ misc/syslog-events
 mkinitramfs
 raid5extend.c
 restripe.c
+sha1.c
+sha1.h
 super0.c
 super1.c
 swap_super.c
diff --git a/mdadm.8 b/mdadm.8
index a3d9dc53b0bdb134faeb2ddce7b55f4309087941..58152b753ff880274f3ab3ad0e42ba88477ee2db 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH MDADM 8 "" v2.4.1
+.TH MDADM 8 "" v2.5
 .SH NAME
 mdadm \- manage MD devices
 .I aka
@@ -281,6 +281,26 @@ on the device, either at the end (for 1.0), at the start (for 1.1) or
 4K from the start (for 1.2).
 .RE
 
+.TP
+.B --homehost=
+This will over-ride any
+.B HOMEHOST
+setting in the config file and provides the identify of the host which
+should be considered the home for any arrays.
+
+When creating an array, the
+.B homehost
+will be recorded in the superblock.  For version-1 superblocks, it will
+be prefixed to the array name.  For version-0.90 superblocks part of
+the SHA1 hash of the hostname will be stored in the later half of the
+UUID.
+
+When reporting information about an array, any array which is tagged
+for the given homehost will be reported as such.
+
+When using Auto-Assemble, only arrays tagged for the given homehost
+will be assembled.
+
 .SH For create, build, or grow:
 
 .TP
@@ -597,7 +617,7 @@ will look for super blocks with a minor number of 0.
 Specify the name of the array to assemble.  This must be the name
 that was specified when creating the array.  It must either match
 then name stored in the superblock exactly, or it must match
-which the current
+with the current
 .I homehost
 is added to the start of the given name.
 
@@ -728,6 +748,14 @@ The
 option will correct the summaries in the superblock. That is the
 counts of total, working, active, failed, and spare devices.
 
+.TP
+.B --auto-update-homehost
+This flag is only meaning with auto-assembly (see discussion below).
+In that situation, if no suitable arrays are found for this homehost,
+.I mdadm
+will recan for any arrays at all and will assemble them and update the
+homehost to match the current host.
+
 .SH For Manage mode:
 
 .TP
@@ -1015,6 +1043,62 @@ option is also available in Build and Create modes.  As those modes do
 not use a config file, the "auto=" config option does not apply to
 these modes.
 
+.SS Auto Assembly
+When
+.B --assemble
+is used with
+.B --scan
+and no devices are listed,
+.I mdadm
+will first attempt to assemble all the arrays listed in the config
+file.
+
+If a
+.B homehost
+has been specified (either in the config file or on the command line),
+.I mdadm
+will look further for possible arrays and will try to assemble
+anything that it finds which is tagged as belonging to the given
+homehost.  This is the only situation where
+.I mdadm
+will assemble arrays without being given specific device name or
+identify information for the array.
+
+If
+.I mdadm
+finds a consistent set of devices that look like they should comprise
+an array, and if the superblock is tagged as belonging to the given
+home host, it will automatically choose a device name and try to
+assemble the array.  If the array uses version-0.90 metadata, then the
+.B minor
+number as recorded in the superblock is used to create a name in
+.B /dev/md/
+so for example
+.BR /dev/md/3 .
+If the array uses version-1 metadata, then the
+.B name
+from the superblock is used to similarly create a name in
+.BR /dev/md .
+The name will have any 'host' prefix stripped first.
+
+If
+.I mdadm
+cannot find any array for the given host at all, and if
+.B --auto-update-homehost
+is given, then
+.I mdadm
+will search again for any array (not just an array created for this
+host) and will assemble each assuming
+.IR --update=homehost .
+This will change the host tag in the superblock so that on the next run,
+these arrays will be found without the second pass.  The intention of
+this feature is to support transitioning a set of md arrays to using
+homehost tagging.
+
+The reason for requiring arrays to be tagged with the homehost for
+auto assembly is to guard against problems that can arise when moving
+devices from one host to another.
+
 .SH BUILD MODE
 
 .HP 12
@@ -1089,6 +1173,24 @@ be over-ridden with the
 .I --force
 option.
 
+When creating an array with version-1 metadata a name for the host is
+required.
+If this is not given with the
+.B --name
+option,
+.I mdadm
+will chose a name based on the last component of the name of the
+device being created.  So if
+.B /dev/md3
+is being created, then the name
+.B 3
+will be chosen.
+If
+.B /dev/md/home
+is being created, then the name
+.B home
+will be used.
+
 '''If the
 '''.B --size
 '''option is given, it is not necessary to list any component-devices in this command.
diff --git a/mdadm.c b/mdadm.c
index fc50d7623fc3c1d9df6649970412aff8dc095fce..f37797a92134e4bb8744320678652cff41c982b7 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
                case 'a':
                case 'r':
                case 'f':
-               case 6: /* re-add */
+               case ReAdd: /* re-add */
                        if (!mode) {
                                newmode = MANAGE;
                                shortopt = short_bitmap_auto_options;
index b7d915e5f676b1d9b91c6f612181a95b47f6a681..b9beffa12cb4e40f05919e7139fe4b6642d05c69 100644 (file)
@@ -291,6 +291,8 @@ MAILADDR root@mydomain.tld
 PROGRAM /usr/sbin/handle-mdadm-events
 .br
 CREATE group=system mode=0640 auto=part-8
+.br
+HOMEHOST <system>
 
 .SH SEE ALSO
 .BR mdadm (8),
index 22bdf8d9f75de3a9cfe776b23d9bfd84f3417202..597d2364ad3466714233e1127a41f05702c2ea8f 100644 (file)
@@ -1,6 +1,6 @@
 Summary:     mdadm is used for controlling Linux md devices (aka RAID arrays)
 Name:        mdadm
-Version:     2.4.1
+Version:     2.5
 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/
index a51e045dc744e640d25a8ad878f0f1432cf9f75c..3055e82e78ef532b3dfdc334110d6ae24611ff4a 100644 (file)
@@ -1,5 +1,5 @@
 .\" -*- nroff -*-
-.TH MDASSEMBLE 8 "" v2.4.1
+.TH MDASSEMBLE 8 "" v2.5
 .SH NAME
 mdassemble \- assemble MD devices
 .I aka
index 9f07ddcc53efcf794368453faf21f6c8940a41e5..8f648f6742efe34a257c2e3e2e02499c5630ed65 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -712,7 +712,7 @@ static int store_super1(struct supertype *st, int fd, void *sbv)
 
        if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) {
                struct bitmap_super_s *bm = (struct bitmap_super_s*)
-                       ((char*)sb)+1024;
+                       (((char*)sb)+1024);
                if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) {
                        locate_bitmap1(st, fd, sbv);
                        write(fd, bm, sizeof(*bm));
diff --git a/test b/test
index 3d722285a6f411e429ce81a5911a5354c5eec57e..696e68218ee69ef6d56eb5a7e0fbace8a1cb8b14 100644 (file)
--- a/test
+++ b/test
@@ -34,7 +34,8 @@ mdsize12=19992
 cleanup() {
        $mdadm -Ss
        for d in 0 1 2 3 4 5 6 7
-       do losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d
+       do
+           losetup -d /dev/loop$d ; # rm -f $targetdir/mdtest$d
         done
 }
 
@@ -44,6 +45,7 @@ devlist=
 for d in 0 1 2 3 4 5 6 7
 do
    [ -f $targetdir/mdtest$d ] || dd if=/dev/zero of=$targetdir/mdtest$d count=$size bs=1K > /dev/null 2>&1
+   [ -b /dev/loop$d ] || mknod /dev/loop$d b 7 $d
    if [ $d -eq 7 ]
    then
      losetup /dev/loop$d $targetdir/mdtest6 # for multipath use
index 19549c50de7174b2c416a304157e8314781971d2..30114b0ac2f274b6f8de3e27a8940d4bbe8eb6d0 100644 (file)
@@ -30,6 +30,7 @@ fi
 mdadm -S $md0
 
 mdadm --assemble -R $md0  $dev2
+mdadm --zero-superblock $dev1
 mdadm $md0 --add $dev1
 check recovery
 
index a76a91922bc285fbb8ef5b8ac0b4e0e0c77c06d9..59664fb14cac35660c3de121a70671a19ff6504f 100644 (file)
@@ -35,6 +35,7 @@ mdadm -S $md0
 
 mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3
 check nosync
+mdadm --zero-superblock $dev2
 mdadm $md0 --add $dev2
 check recovery