11 years agofix examine_brief segfault
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
fix examine_brief segfault

When performing an "-Ebs -e <metadata type>" we segfault because the
superblock has been freed too early.  We also leak memory for 'ddf' and
'imsm' because, unlike super[01], we do not implicitly free when
->load_super is called on an already loaded supertype.

So, fix up imsm and ddf to match type 0 and 1 ->load_super() semantics,
and update Examine to not free the superblock until all usages have been

Signed-off-by: Dan Williams <>
11 years agofix RebuildMap() to retrieve 'subarray' info
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
fix RebuildMap() to retrieve 'subarray' info

RebuildMap falsely returns container info for member arrays.  Retrieving
the subarray and container_dev details prior to ->load_super() changes the
result from:

md127 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/imsm
md126 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/vol0

md126 /md127/0 3e03aee2:78c3c593:1e8ecaf0:eefb53ed /dev/md/vol0
md127 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/imsm

Reported-by: Ignacy Kasperowicz <>
Signed-off-by: Dan Williams <>
11 years agoteach imsm and ddf what st->subarray means at load_super time
Dan Williams [Sat, 1 Aug 2009 00:08:22 +0000 (17:08 -0700)] 
teach imsm and ddf what st->subarray means at load_super time

RebuildMap wants to poll through mdstat and retrieve a (kernel name,
uuid, user name) tuple for each array.  Teach imsm and ddf to honor
st->sub_array at ->load_super() time to set their internal subarray
pointers to the value specified in st->subarray, or return an error if
st->subarray specifies an invalid array.

Signed-off-by: Dan Williams <>
11 years agoExamine: fix --examine --brief --verbose on containers.
NeilBrown [Thu, 4 Jun 2009 02:44:32 +0000 (12:44 +1000)] 
Examine: fix --examine --brief --verbose on containers.

With --verbose, --examine --brief prints dev= information after
the personality has done its bit.
But with containers, the member array are printed in between.
So in super-ddf and super-intel, move printing of the member
arrays to before printing of the container.  This avoids

Signed-off-by: NeilBrown <>
11 years agosuper-intel: fix test on failed_disk_num.
NeilBrown [Thu, 4 Jun 2009 02:29:21 +0000 (12:29 +1000)] 
super-intel: fix test on failed_disk_num.

We sometimes set failed_disk_num to ~0.
However we cannot test for equality with that as  failed_disk_num
is 8bit and ~0 is probably 32bit with lots of 1's.
So test if ~failed_disk_num is 0 instead.

Reported-By: "Mr. James W. Laferriere" <>
Signed-off-by: NeilBrown <>
11 years agoRelease mdadm-3.0 devel-3.0 mdadm-3.0
NeilBrown [Tue, 2 Jun 2009 05:37:56 +0000 (15:37 +1000)] 
Release mdadm-3.0

 - remove lot of old 'ANNOUNCE' files
 - trim changelog
 - update version numbers

Signed-off-by: NeilBrown <>
11 years agoMerge branch 'master' of git:// into devel-3.0
NeilBrown [Tue, 2 Jun 2009 05:28:41 +0000 (15:28 +1000)] 
Merge branch 'master' of git:// into devel-3.0

11 years agoMerge branch 'master' into devel-3.0
NeilBrown [Tue, 2 Jun 2009 05:28:36 +0000 (15:28 +1000)] 
Merge branch 'master' into devel-3.0


11 years agoMove WaitClean from Monitor.c to sysfs.c
NeilBrown [Tue, 2 Jun 2009 05:27:16 +0000 (15:27 +1000)] 
Move WaitClean from Monitor.c to sysfs.c

That way mdmon doesn't need to include Monitor.o

Signed-off-by: NeilBrown <>
11 years agoUpdate copyright dates and remove references to
NeilBrown [Tue, 2 Jun 2009 04:35:45 +0000 (14:35 +1000)] 
Update copyright dates and remove references to

Also removed 'paper' addresses.

Signed-off-by: NeilBrown <>
11 years agoMonitor: reduce default poll interval if mdstat is pollable.
NeilBrown [Tue, 2 Jun 2009 04:35:44 +0000 (14:35 +1000)] 
Monitor:  reduce default poll interval if mdstat is pollable.

Since 2.6.16, mdstat responds to select/poll.
So in that case, increase the default poll interval to about 15
This ensures that the background load is insignificant.

Signed-off-by: NeilBrown <>
11 years agoMonitor: don't get confused if utime is never set.
NeilBrown [Tue, 2 Jun 2009 04:24:58 +0000 (14:24 +1000)] 
Monitor: don't get confused if utime is never set.

externally managed arrays do not (currently) cause utime in
GET_ARRAY_INFO to be updated.  So if it is zero, just assume the
current time.
This will cause GET_DISK_INFO to be called more often, but as we do
the scan only every 60 seconds normally, a few extra syscalls isn't
going to make a big difference.

Signed-off-by: NeilBrown <>
11 years agomdadm.8: Man page updates
NeilBrown [Tue, 2 Jun 2009 04:06:05 +0000 (14:06 +1000)] 
mdadm.8: Man page updates

General review and update of mdadm.8

11 years agoimsm: kill "auto=" in brief_examine_super_imsm
Dan Williams [Mon, 18 May 2009 17:02:58 +0000 (10:02 -0700)] 
imsm: kill "auto=" in brief_examine_super_imsm

The auto parameter is obsolete after kernel version 2.6.28 as all arrays
are partitionable via block device extended minor support.  Environments
that requre the mdp style of array can always edit the configuration
file to specify auto=mdp.

Signed-off-by: Dan Williams <>
11 years agoimsm: fix num_domains
Dan Williams [Mon, 18 May 2009 16:58:55 +0000 (09:58 -0700)] 
imsm: fix num_domains

The 'num_domains' field simply identifies the number of mirrors.  So it
is 2 for a 2-disk raid1 or a 4-disk raid10.  The orom does not currently
support more than 2 mirrors, but a three disk raid1 for example would
increase num_domains to 3.

Signed-off-by: Dan Williams <>
11 years agoMonitor: support spare-group manipulation for 1.x metadata.
NeilBrown [Mon, 11 May 2009 23:49:45 +0000 (09:49 +1000)] 
Monitor: support spare-group manipulation for 1.x metadata.

The code for moving spares around a spare-group currently
only works for 0.90 metadata.  Generalise it for 1.x metadata
as well.

Reported-by: "Garth Snyder" <>
Signed-off-by NeilBrown <>

11 years agoIgnore leading zeros in version number information.
NeilBrown [Mon, 11 May 2009 23:49:06 +0000 (09:49 +1000)] 
Ignore leading zeros in version number information.

--detail sometimes generates leading zero which are just noise.

11 years agoRelease mdadm-3.0-rc1 mdadm-3.0-rc1
NeilBrown [Mon, 11 May 2009 06:33:29 +0000 (16:33 +1000)] 
Release mdadm-3.0-rc1

11 years agoMerge branch 'master' into devel-3.0
NeilBrown [Mon, 11 May 2009 06:05:41 +0000 (16:05 +1000)] 
Merge branch 'master' into devel-3.0


11 years agocreate_mddev: don't replace /dev/mdX with /dev/md/X
NeilBrown [Mon, 11 May 2009 05:58:44 +0000 (15:58 +1000)] 
create_mddev: don't replace /dev/mdX with /dev/md/X

If someone creates/assemble an array called "/dev/md0", don't force
it to be "/dev/md/0".  Doing so isn't really necessary and it
likely to confuse people.

Signed-off-by: NeilBrown <>
11 years agomapfile - when rebuilding, choose an appropriate name is none is found.
NeilBrown [Mon, 11 May 2009 05:58:42 +0000 (15:58 +1000)] 
mapfile - when rebuilding, choose an appropriate name is none is found.

When rebuilding the mapfile (mdadm -Ir), if not appropriate name is
found in /dev/md/, try to find an appropriate name, either by looking
in mdadm.conf or by using the name in the metadata.

Signed-off-by: NeilBrown <>
11 years agoIncr: use devname_matches to when looking in mdadm.conf for bitmap file
NeilBrown [Mon, 11 May 2009 05:47:11 +0000 (15:47 +1000)] 
Incr: use devname_matches to when looking in mdadm.conf for bitmap file

This is more likely to always do the right thing than a strcmp.

Signed-off-by: NeilBrown <>
11 years agomapfile - Fix off-by-one error in RebuildMap
NeilBrown [Mon, 11 May 2009 05:47:11 +0000 (15:47 +1000)] 
mapfile - Fix off-by-one error in RebuildMap

"mdadm -Ir" would get the path for md0 wrong because it
went looking for mdp(-1) by mistake.

Signed-off-by NeilBrown <>

11 years agoFix printf compile warning.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
Fix printf compile warning.

It always afters to cast big things to (unsigned long long) before
printing as %llu - it seems there will always be one arch which
has something to complain about ....

Signed-off-by: NeilBrown <>
11 years agoIncremental: fix uninitialised variable.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
Incremental: fix uninitialised variable.

st2 might not be initialised at this point.  So use the
more correct 'st'.

Signed-off-by: NeilBrown <>
11 years agoIncr: cope better with possibility that mp->path might be NULL
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
Incr: cope better with possibility that mp->path might be NULL

Signed-off-by: NeilBrown <>
11 years agomapfile: allow the path name to the device to be empty.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
mapfile:  allow the path name to the device to be empty.

Allowing an empty name and coping with it is less confusing
than seeing "/empty" appear.

Signed-off-by: NeilBrown <>
11 years agomap_dev: prefer names in /dev/md/
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
map_dev: prefer names in /dev/md/

Rather than preferring non-standard names (of which there are
many, like /dev/block/9:1), prefer names in /dev/md/ when finding
the name of an md device.

Signed-off-by: NeilBrown <>
11 years agoudev-md-raid.rules: use string_escape
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
udev-md-raid.rules: use string_escape

For safety, "MD_NAME" strings should be escaped in udev.

Signed-off-by: NeilBrown <>
11 years agosuper1 - fix brief examine.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
super1 - fix brief examine.

We manage to lose some space here...

Signed-off-by: NeilBrown <>
11 years agoman pages: note that --auto is largely deprecated and irrelevant.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
man pages: note that --auto is largely deprecated and irrelevant.

Signed-off-by: NeilBrown <>
11 years agoBe more consistent about keeping the host: prefix on array names.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
Be more consistent about keeping the host: prefix on array names.

If an array name contains a "hostname:" prefix, then
--assemble will tend to leave it there, while --incremental
will strip it off (when chosing a device name during auto-assembly).

Make this more consistent:  strip the name off if we decide that
the name will be treated as 'local'.  Leave it on if it will be
treated as 'foreign'.

Signed-off-by: NeilBrown <>
11 years agoconfig: enhance name matching in conf_get_ident.
NeilBrown [Mon, 11 May 2009 05:47:10 +0000 (15:47 +1000)] 
config: enhance name matching in conf_get_ident.

Use when searching mdadm.conf for a device, use more flexible
matching that e.g. ignores leading /dev/md/ or /dev/

As mdadm now accepts both "/dev/md/foo" and "foo" is many places as
equivalent, they should compare as the same.

Signed-off-by: NeilBrown <>
11 years agoAllow homehost to be largely ignored when assembling arrays.
NeilBrown [Mon, 11 May 2009 05:46:46 +0000 (15:46 +1000)] 
Allow homehost to be largely ignored when assembling arrays.

If mdadm.conf contains
   HOMEHOST <ignore>
or commandline contains

then the check that array metadata mentions the given homehost is
replace by a check that the name recorded in the metadata is not
already used by some other array mentioned in mdadm.conf.

This allows more arrays to use their native name rather than having
an _NN suffix added.

This should only be used during boot time if all arrays required for
normal boot are listed in mdadm.conf.

If auto-assembly is used to find all array during boot, then the
HOMEHOST feature should be used to ensure there is no room for
confusion in choosing array names, and so it should not be set
to <ignore>.

Signed-off-by: NeilBrown <>
11 years agoutil: fix test for text_version
NeilBrown [Mon, 11 May 2009 05:21:43 +0000 (15:21 +1000)] 
util: fix test for text_version

as text_version is a char array (not a pointer), testing the
address against NULL is the wrong thing to do.  Test the
content instead.

Signed-off-by: NeilBrown <>
11 years agoAssemble/Incr : minor tidy up of setting 'trustworthy'.
NeilBrown [Mon, 11 May 2009 05:19:30 +0000 (15:19 +1000)] 
Assemble/Incr : minor tidy up of setting 'trustworthy'.

Signed-off-by: NeilBrown <>
11 years agoconfig: allow Array line to contain array name without /dev/md/ prefix.
NeilBrown [Mon, 11 May 2009 05:18:35 +0000 (15:18 +1000)] 
config: allow Array line to contain array name without /dev/md/ prefix.

For consistency with --create and --assemble, allow the array name
given in mdadm.conf to exclude the "/dev/md/" prefix.  So e.g.

  ARRAY home uuid=whatever

is treated like

  ARRAY /dev/md/home uuid=whatever

Also exclude names which create_mddev will reject.

Signed-off-by: NeilBrown <>
11 years agoFix tests on ->container and ->member
NeilBrown [Mon, 11 May 2009 05:18:25 +0000 (15:18 +1000)] 
Fix tests on ->container and ->member

For container= and member= to be effective in an mdadm.conf line
they must both be present.  So when checking for their absence we
need container != NULL || member != NULL.

Signed-off-by: NeilBrown <>
11 years agoMake --brief even briefer.
NeilBrown [Mon, 11 May 2009 05:18:20 +0000 (15:18 +1000)] 
Make --brief even briefer.

Because ---examine --brief, or --detail --brief are
often used to create mdadm.conf, and because people don't want to
have to update their mdadm.conf unnecessarily, we don't want to
include information that might change.
And now that level changing is supported, that is almost everything
but UUID.

So move some more fields into the "Only print with --verbose" class.

Signed-off-by: NeilBrown <>
11 years agomdadm.8 general updates
NeilBrown [Mon, 11 May 2009 05:17:50 +0000 (15:17 +1000)] 
mdadm.8  general updates

Signed-off-by: NeilBrown <>
11 years agoconf/assemble: new config line "auto".
NeilBrown [Mon, 11 May 2009 05:17:33 +0000 (15:17 +1000)] 
conf/assemble:  new config line "auto".

The line 'auto' in mdadm.conf can be used to disable assembly
of specific metadata types, or of all arrays.

This does not affect assembly of arrays listed in mdadm.conf
or on command line.

 auto -all

will disable all auto-assembly.

 auto -ddf

will cause mdadm to ignore ddf arrays that are not explicitly
mentioned, and auto assemble anything else it finds.

Signed-off-by: NeilBrown <>
11 years agoconfig: support "ARRAY <ignore> ..." lines in mdadm.conf
NeilBrown [Mon, 11 May 2009 05:17:05 +0000 (15:17 +1000)] 
config: support "ARRAY <ignore> ..." lines in mdadm.conf

Sometimes we want to ensure particular arrays are never
assembled automatically.  This might include an array made of
devices that are shared between hosts.

To support this, allow ARRAY lines in mdadm.conf to use the word
"ignore" rather than a device name.  Arrays which match such lines
are never automatically assembled (though they can still be assembled
by explicitly giving identification information on the mdadm command

Signed-off-by: NeilBrown <>
11 years agoassemble: support arrays created with --homehost=any
NeilBrown [Mon, 11 May 2009 05:16:49 +0000 (15:16 +1000)] 
assemble:  support arrays created with --homehost=any

If an array is created with --homehost=any, then --assemble and
--incremental will treat it as being local to 'this' host, no matter
what the name of this host is.

This is useful for array that will be given unique names and be
moved between machines.

This needs to be documented.

Signed-off-by: NeilBrown <>
11 years agocreate_dev - allow array names like mdX and /dev/mdX to appear 'numeric'
NeilBrown [Mon, 11 May 2009 05:16:47 +0000 (15:16 +1000)] 
create_dev - allow array names like mdX and /dev/mdX to appear 'numeric'

When choosing the minor number to use with an array, we currently base
the number of the 'name' stored in the metadata if that name is
Extend that so that if it looks like a number md device name (/dev/md0
or just md0 or even /dev/md/0), then we use the number at the end to
suggest a minor number.

The means that if someone creates and array with "--name md0" or even
"--name /dev/md0" it will continue to do what they expect.

Signed-off-by: NeilBrown <>
11 years agore-add error check
NeilBrown [Tue, 5 May 2009 11:13:29 +0000 (21:13 +1000)] 
re-add error check

11 years agoFix gcc-4.4 compiler warning.
NeilBrown [Wed, 29 Apr 2009 01:44:02 +0000 (11:44 +1000)] 
Fix gcc-4.4 compiler warning.

Apparently the dereferencing of a type-punned pointer breaks strict
aliasing rules.   And we wouldn't want to do that.
So just make a different array of the appropriate type and use memcpy.

Resolves-Debian-bug: 505375
Signed-off-by: NeilBrown <>
11 years agoMakefile: use $(CC) more consistently.
NeilBrown [Wed, 29 Apr 2009 01:21:08 +0000 (11:21 +1000)] 
Makefile: use $(CC) more consistently.

Explicitly calling 'gcc' in some rules makes it hard to test with
other compilers.

11 years agomdadm: allow build to use --size
Paul Clements [Wed, 11 Feb 2009 18:49:26 +0000 (13:49 -0500)] 
mdadm: allow build to use --size

This patch enables the --size parameter for build operations.

Without this, if you have a raid1, for instance, where the 2 disks are
not the exact same size, and you need to build the array but one of the
disks is not available right at the moment (maybe it's USB and it's
unplugged, or maybe it's a network disk and it's unavailable), then you
have to play some weird games to get the array to size correctly (that
is, to the size of the smaller of the two components or less).

There may be other uses for this too...


Signed-off-by: NeilBrown <>
11 years agoWait for POLLPRI on /proc or /sys files.
NeilBrown [Tue, 14 Apr 2009 04:59:24 +0000 (14:59 +1000)] 
Wait for POLLPRI on /proc or /sys files.

From 2.6.30, /proc/mounts and various /sys files will
probably always returns 'readable' to select, so we will need
to wait on POLLPRI to get the 'new data is available' signal.

When using select, this corresponds to an 'exception', so
adjust calls to select accordingly.
In one case we sometimes wait on a socket and sometime on
/proc/mounts, so we need to test which.

Signed-off-by: NeilBrown <>
11 years agoMerge branch 'master' of git:// into devel-3.0
NeilBrown [Tue, 14 Apr 2009 01:11:14 +0000 (11:11 +1000)] 
Merge branch 'master' of git:// into devel-3.0

Due to independent fixes for the "mdadm hangs if reshape finishes too quickly"

11 years agoudev rules fix for partitions.
NeilBrown [Tue, 14 Apr 2009 00:58:54 +0000 (10:58 +1000)] 
udev rules fix for partitions.

sysfs directories for partitions do not have md/* files, but
should not for that reason be ignored.

Thanks to Michal Soltys for original fix.

Signed-off-by: Michal Soltys <>
Signed-off-by: NeilBrown <>
11 years agomapfile: optionally store map file in /dev
NeilBrown [Tue, 14 Apr 2009 00:49:40 +0000 (10:49 +1000)] 
mapfile:  optionally store map file in /dev

During early boot, /var/run may not exist or be writable.
If that happens, sore the mapfile (which is very important for
incremental assembly) in /dev (which should exist for udev).

Thanks to Doug Ledford <> for identify this
problem and suggesting a solution.

Signed-off-by: NeilBrown <>
11 years agotests: basic ddf tests
NeilBrown [Tue, 14 Apr 2009 00:19:06 +0000 (10:19 +1000)] 
tests: basic ddf tests

Test script to create a ddf with three different member arrays,
and assemble it in a variety of ways.

Signed-off-by: NeilBrown <>
11 years agotests: add some simple data integrity tests for raid5/raid6
NeilBrown [Tue, 14 Apr 2009 00:19:05 +0000 (10:19 +1000)] 
tests:  add some simple data integrity tests for raid5/raid6

Make sure the data is preserved even when the array is degraded.

Signed-off-by: NeilBrown <>
11 years ago.gitignore update
NeilBrown [Tue, 14 Apr 2009 00:19:04 +0000 (10:19 +1000)] 
.gitignore update

Add a few more generated files to .gitignore

Signed-off-by: NeilBrown <>
11 years agoincremental_container: preserve 'in_sync' flag when adding to existing array.
NeilBrown [Tue, 14 Apr 2009 00:19:02 +0000 (10:19 +1000)] 
incremental_container: preserve 'in_sync' flag when adding to existing array.

When building container members with -IR, we need to ensure that
devices added to an active array preserve the 'in_sync' status so they
don't needlessly get rebuilt.

So allow sysfs_add_disk to do this (only works in kernels since
2.6.30) and pass the relevant flag down.

Signed-off-by: NeilBrown <>
11 years agomdmon: fix resync completion detection
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
mdmon: fix resync completion detection

Starting with 2.6.30 the md/resync_start attribute will no longer return
a non-sensical number when resync is complete, instead it now returns

Signed-off-by: Dan Williams <>
11 years agoGrow: fix hang when reshape completes too fast
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
Grow: fix hang when reshape completes too fast

For short reshapes the kernel may be done before mdadm can check that
progress has passed the critical section.

Signed-off-by: Dan Williams <>
11 years agoRebuildMap: handle missing disks
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
RebuildMap: handle missing disks

When rebuilding the map file tolerate missing/offline disks, otherwise
we will segfault on the NULL return from sysfs_read.

Reported-by: Jacek Danecki <>
Signed-off-by: Dan Williams <>
11 years agoimsm: add the ddf field
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
imsm: add the ddf field

This field is always one in arrays created by the Windows driver / OROM,
not sure why...

Signed-off-by: Dan Williams <>
11 years agoimsm: round down array size at Create
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
imsm: round down array size at Create

Store the 1MB rounded down size of the array at create time.

Signed-off-by: Dan Williams <>
11 years agoimsm: set array size at Create/Assemble
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
imsm: set array size at Create/Assemble

imsm arrays round down the effective array size to the closest 1
megabyte boundary so teach get_info_super_imsm and sysfs_set_array to
set 'md/array_size' if available (and make sure ddf uses the default

Signed-off-by: Dan Williams <>
11 years agoimsm: turn off curr_migr_unit updates
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
imsm: turn off curr_migr_unit updates

New documentation shows that this field is not equivalent to
md/resync_start.  Disable updates until full support can be developed.

Writing '0' when a migration starts/re-starts remains correct.

Signed-off-by: Dan Williams <>
11 years agoimsm: defend against unsupported migrations (temporary)
Dan Williams [Sun, 12 Apr 2009 07:58:28 +0000 (00:58 -0700)] 
imsm: defend against unsupported migrations (temporary)

Until support for higher order migrations (online capacity expansion,
raid level migration, chunk size migration...) are implemented do not
allow arrays in these states to be assembled.

Signed-off-by: Dan Williams <>
11 years agoimsm: add 'verify', 'verify with fixup', and 'general' migration types
Dan Williams [Sun, 12 Apr 2009 07:58:27 +0000 (00:58 -0700)] 
imsm: add 'verify', 'verify with fixup', and 'general' migration types

imsm distinguishes parity initialization from parity checking in the
metadata. Older option roms marked the repair operation with the
'verify' type and a 'with fixup' flag in the raid device 'status' field.

Signed-off-by: Dan Williams <>
11 years agoimsm: fix imsm_map.num_domains
Dan Williams [Sun, 12 Apr 2009 07:58:27 +0000 (00:58 -0700)] 
imsm: fix imsm_map.num_domains

'num_domains' is the number of parity domains.  I.e. 2 in the raid10
case (2-mirrors), while raid0 through raid5 have 1 parity domain (even
though raid0 does not have parity).

Signed-off-by: Dan Williams <>
11 years agoimsm: ensure mpb buffer is zeroed
Dan Williams [Sun, 12 Apr 2009 07:58:27 +0000 (00:58 -0700)] 
imsm: ensure mpb buffer is zeroed

Don't leak unitialized data into the mpb.

Signed-off-by: Dan Williams <>
11 years agoimsm: support --examine --export
Dan Williams [Sun, 12 Apr 2009 04:53:25 +0000 (21:53 -0700)] 
imsm: support --examine --export

Signed-off-by: Dan Williams <>
11 years agoimsm: make uuid separator consistent with ddf
Dan Williams [Sun, 12 Apr 2009 04:53:25 +0000 (21:53 -0700)] 
imsm: make uuid separator consistent with ddf

'-' to ':'

Signed-off-by: Dan Williams <>
11 years agoimsm: extract right-most whitespace stripped serial number
Dan Williams [Wed, 8 Apr 2009 18:41:51 +0000 (11:41 -0700)] 
imsm: extract right-most whitespace stripped serial number

According to new documentation the metadata expects that all whitespace
(characters <= 0x20) are stripped from the incoming serial number.  If
the length remains longer than MAX_RAID_SERIAL_LEN then only the
right-most characters are preserved.

Signed-off-by: Dan Williams <>
11 years agomdadm udev rules change
Doug Ledford [Wed, 8 Apr 2009 07:32:55 +0000 (17:32 +1000)] 
mdadm udev rules change

I'm not attaching a patch for this because it's so simple.  Long story
short, watching both add and change events in udev rules is bad for md
devices.  Specifically, the kernel will generate a change event on
things like array stop, and on things like fdisk close.  In the case
of array stop, it can result in the array being assembled again
immediately.  In the case of fdisk close, the situation is worse.
Let's say you stop all the md devices on some block device in order to
repartition.  You run fdisk, change the partition table, then issue a
write of the table.  The write of the table triggers the change event
*before* the kernel updates the partition table in memory for the
block device, causing udev to rerun the incremental rules on the old
partition table and restart all the arrays you just stopped with the
old partition table layout, at which point the kernel is unable to
reread the partition table.  So, once you've enable incremental
assembly, it becomes apparent that what we really want is to only
start devices on add, not on add|change.


Doug Ledford <>

11 years agosuper-ddf: fix compile warnings on ppc64
Doug Ledford [Wed, 8 Apr 2009 07:25:52 +0000 (17:25 +1000)] 
super-ddf: fix compile warnings on ppc64

Simple patch to silence some compile warnings that only show up on
64bit arches.

Signed-off-by: Doug Ledford <>
Signed-off-by: NeilBrown <>
11 years agoIncremental - avoid NULL dereference.
NeilBrown [Tue, 7 Apr 2009 07:54:09 +0000 (17:54 +1000)] 
Incremental - avoid NULL dereference.

There structure returned by sysfs_read might not have any 'devs',
don't assume it does.

Signed-off-by: NeilBrown <>
11 years agotest: minor fixes
NeilBrown [Tue, 7 Apr 2009 07:50:34 +0000 (17:50 +1000)] 
test: minor fixes

 - allow core files to be dumped.
 - modprobe md_mod if needed to write to

Signed-off-by: NeilBrown <>
11 years agoIncremental: be more relaxed about member arrays not completely assembling.
NeilBrown [Tue, 7 Apr 2009 07:49:05 +0000 (17:49 +1000)] 
Incremental: be more relaxed about member arrays not completely assembling.

During incremental assembly, if the member array doesn't assemble
properly (yet), that isn't an error.

Signed-off-by: NeilBrown <>
11 years agoAssemble: call map_update even when not starting the array.
NeilBrown [Tue, 7 Apr 2009 07:45:42 +0000 (17:45 +1000)] 
Assemble: call map_update even when not starting the array.

For incremental assembly to work, we need to keep the 'map'
up-to-date even when not starting the array yet.

Signed-off-by: NeilBrown <>
11 years agoddf: fixed 'working_disks' reported by container_content.
NeilBrown [Tue, 7 Apr 2009 07:41:55 +0000 (17:41 +1000)] 
ddf: fixed 'working_disks' reported by container_content.

The 'work_disks' number should be the number that is expected, not the
number found so far.   This is needed for Incremental assembly to
start the array at the right time.

Signed-off-by: NeilBrown <>
11 years agoddf: improve print out of physical devices.
NeilBrown [Tue, 7 Apr 2009 07:40:24 +0000 (17:40 +1000)] 
ddf: improve print out of physical devices.

Just add some more space really.

Signed-off-by: NeilBrown <>
11 years agoddf: fix variable name overload
NeilBrown [Tue, 7 Apr 2009 07:38:25 +0000 (17:38 +1000)] 
ddf: fix variable name overload

The variable 'i' was being used as a loop variable, and also
for something else inside the loop.   So make the larger loop have a
more meaningful name.

Signed-off-by: NeilBrown <>
11 years agowait_for improvement.
NeilBrown [Tue, 7 Apr 2009 07:34:38 +0000 (17:34 +1000)] 
wait_for improvement.

wait not only for the name to appear, but for it to refer to the
correct device.
Sometimes old symlinks left lying around can be confusing.

Signed-off-by: NeilBrown <>
11 years agoconfig: treat "container=" and "member=" and providing the required identity information.
NeilBrown [Mon, 6 Apr 2009 06:09:52 +0000 (16:09 +1000)] 
config: treat "container=" and "member=" and providing the required identity information.

Signed-off-by: NeilBrown <>
11 years agoDetail: use meaningful names with --scan.
NeilBrown [Mon, 6 Apr 2009 05:54:51 +0000 (15:54 +1000)] 
Detail: use meaningful names with --scan.

When reporting "--detail --scan", use names like /dev/md/foo where
available rather than /dev/md/127

This is particularly needed for containers where the member arrays
will report "container=/dev/md/foo" and we want the container to have
the same name.

Signed-off-by: NeilBrown <>
11 years agoCreate: round to chunk size
NeilBrown [Mon, 6 Apr 2009 05:53:31 +0000 (15:53 +1000)] 
Create: round to chunk size

There are probably other places where rounding size to
chunksize is needed, or useful, but this is a good start.

Signed-off-by: NeilBrown <>
11 years agotest: support testing DDF
NeilBrown [Mon, 6 Apr 2009 05:52:13 +0000 (15:52 +1000)] 
test: support testing DDF

DDF requires larger devices as 32Meg is reserved.

So allocated larger loop devices for DDF tests.

Signed-off-by: NeilBrown <>
11 years agoutil.c: use correct range for minor numbers when finding free device.
NeilBrown [Mon, 6 Apr 2009 05:50:56 +0000 (15:50 +1000)] 
util.c: use correct range for minor numbers when finding free device.

Minor numbers are 20 bits, not 22.
So when looking for a free, high minor number, try (1<<20)-1,
not (1<<22)-1.

11 years agoddf: make sure Create fails if devices are too small.
NeilBrown [Thu, 2 Apr 2009 03:02:33 +0000 (14:02 +1100)] 
ddf: make sure Create fails if devices are too small.

Signed-off-by: NeilBrown <>
11 years agoddf: fix bug with error returns.
NeilBrown [Thu, 2 Apr 2009 02:37:34 +0000 (13:37 +1100)] 
ddf: fix bug with error returns.

In some cases we should only print an error message if
'devname' is defined.  In fact we were only returning
the error at all in that case!!

Signed-off-by: NeilBrown <>
11 years agoism-tests: fix the imsm-create-fail-rebuild test
NeilBrown [Wed, 1 Apr 2009 02:51:57 +0000 (13:51 +1100)] 
ism-tests: fix the imsm-create-fail-rebuild test

it was testing the return status of mdadm wrongly, and
I found I needed a 'udevadm settle'.

11 years agotest: return correct error status for mdadm
NeilBrown [Wed, 1 Apr 2009 02:50:19 +0000 (13:50 +1100)] 
test: return correct error status for mdadm

mdadm's return status is being hidden by the 'test' script so
individual tests cannot see it.

11 years agoMakefile: build 'mdmon' for 'test'
NeilBrown [Wed, 1 Apr 2009 02:49:34 +0000 (13:49 +1100)] 
Makefile:  build 'mdmon' for 'test'

  make test
might not prepare everything for running tests.

11 years agogrow: don't wait forever for critical section to pass.
NeilBrown [Wed, 1 Apr 2009 01:26:08 +0000 (12:26 +1100)] 
grow: don't wait forever for critical section to pass.

If an array reshape completed within 1 second, then --grow will not
notice that it has finished and will keep waiting for the critical
section to pass.

So be more cautious in the test.

Signed-off-by: NeilBrown <>
11 years agoRelease mdadm-3.0-devel3 mdadm-3.0-devel3
NeilBrown [Tue, 10 Mar 2009 05:59:57 +0000 (16:59 +1100)] 
Release mdadm-3.0-devel3

11 years agoMerge branch 'master' in devel-3.0
NeilBrown [Tue, 10 Mar 2009 05:47:02 +0000 (16:47 +1100)] 
Merge branch 'master' in devel-3.0

11 years agoRelease mdadm-2.6.9 mdadm-2.6.9
NeilBrown [Tue, 10 Mar 2009 05:38:37 +0000 (16:38 +1100)] 
Release mdadm-2.6.9

11 years agomdmon: allow incremental assembly of containers.
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
mdmon: allow incremental assembly of containers.

If mdmon sees a device added to a container, it should assume it is
a new spare.  It could be a part of the array that just hadn't been
assembled yet.  So check first.

Signed-off-by: NeilBrown <>
11 years agoDDF: fix up container_content
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
DDF: fix up container_content

If we haven't got hold of all the devices yet, we need to be
ready to skip over some while gathering content information.

Signed-off-by: NeilBrown <>
11 years agoAssemble/container: catch errors when starting a partial container.
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
Assemble/container: catch errors when starting a partial container.

If we are assembling an array in a container and it isn't complete
enough to start yet, then
  - don't start mdmon
  - don't say the array is started
  - don't wait for the device to appear in /dev

Signed-off-by: NeilBrown <>
11 years agoIncremental/container: don't create when we should just be opening.
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
Incremental/container:  don't create when we should just be opening.

When incr-assembling in a container, if the array already exists,
don't try to create it again, just open it.

Signed-off-by: NeilBrown <>
11 years agomdopen: be more careful when adding digit to names.
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
mdopen:  be more careful when adding digit to names.

If we need to add digits to a name to make it unique, but don't have
to add '_', we need to avoid adding a digit immediately after a digit.
So if the last character of the name is a digit, add the '_' anyway.

Signed-off-by: NeilBrown <>
11 years agoIncremental: fix some handling of trustworthy.
NeilBrown [Tue, 10 Mar 2009 05:28:22 +0000 (16:28 +1100)] 
Incremental:  fix some handling of trustworthy.

1/ if homehost matches, then we need to set trustworthy to 'LOCAL'
2/ if we decide to set trustworthy to 'METADATA' because we have to
   use the metadata version name, do that *after* we have checked if
   we are going to assemble within a container, as inside the
   container there could be different sources of names to use.

Signed-off-by: NeilBrown <>