]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
15 years agoCreate: allow per-metadata default layouts
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)] 
Create: allow per-metadata default layouts

Let handlers specifiy their own defaults, specifically needed for the
imsm-raid5 case where mdadm defaults to 'ls' and imsm to 'la'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: make switchroot an undecorated option
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)] 
mdmon: make switchroot an undecorated option

Simplify the usage from:
mdmon [--switch-root dir] /device/name/for/container
to...
mdmon /device/name/for/container [target_dir]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAssemble: fix busy detection
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)] 
Assemble: fix busy detection

Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays.

Ran into this after an encountering a case where mdadm -Ss ended in
segfault (missing check for NULL return from map_by_devnum() in
sles11:Manage.c).  So, tried to stop the array by hand with echo clear >
md/array_state, after which I could not reassemble since GET_ARRAY_INFO
was succeeding.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: support scanning for containers
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)] 
mdmon: support scanning for containers

When the given container is '/proc/mdstat' then launch an mdmon instance
per container found in /proc/mdstat.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: expand permissible container device names
Dan Williams [Tue, 20 Jan 2009 08:36:50 +0000 (01:36 -0700)] 
mdmon: expand permissible container device names

Allow any path that dereferences to an md device to be used in addition
to the current symbolic md device names.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: imsm_read_serial check for zero-length response
Dan Williams [Tue, 20 Jan 2009 08:33:56 +0000 (01:33 -0700)] 
imsm: imsm_read_serial check for zero-length response

VMWare virtual disks successfully run the inquiry but return a zero response.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix dev_open return value handling
Dan Williams [Tue, 20 Jan 2009 07:29:34 +0000 (00:29 -0700)] 
imsm: fix dev_open return value handling

dev_open returns an fd

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: fix missing ->subarray initialization
Dan Williams [Tue, 13 Jan 2009 22:46:05 +0000 (15:46 -0700)] 
mdmon: fix missing ->subarray initialization

This can cause mdmon to fail at startup.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoMerge branch 'master' into scratch-3.0
NeilBrown [Wed, 7 Jan 2009 22:31:28 +0000 (09:31 +1100)] 
Merge branch 'master' into scratch-3.0

Conflicts:

Assemble.c
config.c

15 years agoFail overtly when asprintf fails to allocate memory
Dustin Kirkland [Wed, 7 Jan 2009 22:25:33 +0000 (09:25 +1100)] 
Fail overtly when asprintf fails to allocate memory

.. rather that causing a less-obvious violation of segments.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFree mdstat data structures properly.
NeilBrown [Wed, 7 Jan 2009 22:25:31 +0000 (09:25 +1100)] 
Free mdstat data structures properly.

In one case we called 'free' instead of 'mdstat_free'.
In others we didn't free at all.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm...
NeilBrown [Thu, 18 Dec 2008 05:58:25 +0000 (16:58 +1100)] 
Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0

15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Thu, 18 Dec 2008 05:56:13 +0000 (16:56 +1100)] 
Merge branch 'master' into devel-3.0

Conflicts:

Assemble.c
Incremental.c
Kill.c
ReadMe.c
inventory
mapfile.c
mdadm.8
mdadm.spec
mdassemble.8

15 years agomap: rebuild map if it doesn't exist.
NeilBrown [Thu, 18 Dec 2008 05:23:46 +0000 (16:23 +1100)] 
map: rebuild map if it doesn't exist.

It is possible for some arrays to be created e.g. by initrd, and so
not get mentioned in /var/run/mdadm/map.
As "-I" depends on things being listed in 'map', we create it by
scanning all devices if it doesn't exist.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: set stripe_cache_size properly when restarting a reshape.
NeilBrown [Thu, 18 Dec 2008 03:24:41 +0000 (14:24 +1100)] 
Assemble: set stripe_cache_size properly when restarting a reshape.

Reshape with large chunk size can require a large stripe_cache.
We make this work when starting the reshape but not when
restarting at assemble time.  So fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: don't assume array is 'clean' unless all devices think it is.
NeilBrown [Thu, 18 Dec 2008 03:11:59 +0000 (14:11 +1100)] 
Assemble: don't assume array is 'clean' unless all devices think it is.

This is only significant for --assemble --force where some old
devices might be included into the array.  If anything looks like
it isn't clean, the kernel will not allow a degraded array to be started.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoKill: Don't use O_EXCL when --force is used.
NeilBrown [Thu, 18 Dec 2008 03:04:45 +0000 (14:04 +1100)] 
Kill:  Don't use O_EXCL when --force is used.

We really want --zero-super --force to zero the superblock in
all situations.  So don't open with O_EXCL - trust the user.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoimsm: test overlapping creates
Dan Williams [Mon, 8 Dec 2008 23:59:19 +0000 (16:59 -0700)] 
imsm: test overlapping creates

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoworkaround a hald interaction and quiet cleanup
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
workaround a hald interaction and quiet cleanup

The 'udevadm settle' call appears to resolve:

mdadm: failed to stop array /dev/md127: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agotest: enable per-test custom environment setup/teardown
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
test: enable per-test custom environment setup/teardown

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: don't take chunk_size into account for raid1
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: don't take chunk_size into account for raid1

Results in chopping off usable parts of the requested size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: reverse swapped arguments to posix_memalign in imsm_prepare_update
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: reverse swapped arguments to posix_memalign in imsm_prepare_update

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: convert dev_tbl to devlist
Dan Williams [Mon, 8 Dec 2008 23:57:08 +0000 (16:57 -0700)] 
imsm: convert dev_tbl to devlist

...to facilitate testing arbitrary numbers of raid devices

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: provide a detail_platform method
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: provide a detail_platform method

Dump the orom capabilities and hardware disk configuration.  This code
relies on the name of scsi_host objects to determine the hardware port
number.  Hopefully this information is stable...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agointroduce --detail-platform to display platform raid capabilities
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
introduce --detail-platform to display platform raid capabilities

Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: validate arrays being created against firmware capabilities
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: validate arrays being created against firmware capabilities

These checks are only enabled when platform support for imsm is found,
i.e. ahci driver is loaded and talking to an Intel(R) controller, and
the option rom header is located.

They can be turned off by setting the environment variable
IMSM_NO_PLATFORM to 1.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: sysfs support routines for determining device connectivity
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: sysfs support routines for determining device connectivity

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: detect option-rom capabilities
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
imsm: detect option-rom capabilities

The option-rom advertises its capabilities in a data structure located in
the platform ROM region 0xc0000-0xf0000.  Attempt to detect the option-rom
and limit array creation to the platform's capabilities.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoport arch/x86/kernel/probe_roms_32.c for use in 'platform' support
Dan Williams [Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)] 
port arch/x86/kernel/probe_roms_32.c for use in 'platform' support

This provides at least a kernel bug compatible method of scanning for an
adapter-rom.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: pass disk info in create message
Dan Williams [Mon, 8 Dec 2008 18:46:57 +0000 (11:46 -0700)] 
imsm: pass disk info in create message

We may be creating on spare disks in which case we need to know which
disk goes in which slot.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: correct start offset handling at create time
Dan Williams [Mon, 8 Dec 2008 18:38:59 +0000 (11:38 -0700)] 
imsm: correct start offset handling at create time

imsm metadata requires all members of a raid volume to start at the same
offset.  So, incrementally build a composite disk from all the
candidates passed to ->validate_geometry.  After each disk is added
merge the extents and search for a common start offset that satisfies
the requested raid device size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix setting of device size for raid1
Dan Williams [Mon, 8 Dec 2008 18:28:54 +0000 (11:28 -0700)] 
imsm: fix setting of device size for raid1

When chunksize is 0 in the raid1 case we need to use
info_to_blocks_per_member() to calculate the array size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agowait_for container assembly
Dan Williams [Mon, 8 Dec 2008 23:59:17 +0000 (16:59 -0700)] 
wait_for container assembly

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoDDF: improve --examine output
NeilBrown [Thu, 4 Dec 2008 06:10:43 +0000 (17:10 +1100)] 
DDF: improve --examine output

Make this more readable and in line with other
metadata types by providing a table for the devices.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoCreate: support autolayout when creating in a DDF
NeilBrown [Thu, 4 Dec 2008 05:08:33 +0000 (16:08 +1100)] 
Create: support autolayout when creating in a DDF

If, when creating an array, a signal target device is given which
is a container, then allow the metadata handler to choose which
devices to use.
This is currently only supported for DDF.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoChange 'size' argument to validate_geometry to be sectors, not K
NeilBrown [Thu, 4 Dec 2008 04:47:57 +0000 (15:47 +1100)] 
Change 'size' argument to validate_geometry to be sectors, not K

That way it is the same a *freesize, and generally less confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agofix ->metadata_version checking in Wait()
Dan Williams [Wed, 3 Dec 2008 05:45:43 +0000 (22:45 -0700)] 
fix ->metadata_version checking in Wait()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAllow --config in --incremental mode.
NeilBrown [Thu, 18 Sep 2008 05:05:46 +0000 (15:05 +1000)] 
Allow --config in --incremental mode.

15 years agoCreate: print message when preparing a container.
NeilBrown [Fri, 28 Nov 2008 02:59:36 +0000 (13:59 +1100)] 
Create: print message when preparing a container.

We currently print e.g. "Array /dev/md0 started", but nothing for
containers.
Fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRelease 2.6.8 mdadm-2.6.8
NeilBrown [Fri, 28 Nov 2008 01:14:57 +0000 (12:14 +1100)] 
Release 2.6.8

15 years agoFix typo in mdadm.conf.5
NeilBrown [Fri, 28 Nov 2008 00:52:16 +0000 (11:52 +1100)] 
Fix typo in mdadm.conf.5

Debian Bug #506245

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agofix add_dev() handling of broken links
Dan Williams [Mon, 10 Nov 2008 16:30:07 +0000 (09:30 -0700)] 
fix add_dev() handling of broken links

Resolves issues like:
mdadm -Ss
mdadm: unable to open /dev/md/r1: No such file or directory

...where /dev/md/r1 points to a removed device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Thu, 27 Nov 2008 04:48:45 +0000 (15:48 +1100)] 
Merge branch 'master' into devel-3.0

15 years agoAssemble: allow --force to work even when event counts are 0.
NeilBrown [Thu, 27 Nov 2008 04:46:51 +0000 (15:46 +1100)] 
Assemble: allow --force to work even when event counts are 0.

If any superblocks in a confused array had an event count of 0,
"mdadm -Af" would not update the event counts to assemble the array.
I don't remember why that text is there, and it has caused at least
one situation to be difficult to recover from.  So remove the
test.  --force means --force!

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: wait for device to appear via udev
NeilBrown [Thu, 27 Nov 2008 04:43:22 +0000 (15:43 +1100)] 
Assemble: wait for device to appear via udev

Use the new "wait_for" function to make sure udev has created
the device before completion the 'assemble'.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoimsm: fix metadata reservation
Dan Williams [Wed, 26 Nov 2008 22:39:51 +0000 (15:39 -0700)] 
imsm: fix metadata reservation

1/ When truncating the space reserved for the metadata round down to an
   even numbered sector count to avoid an off-by-one error when
   sysfs_add_disk rounds up.
2/ Set the current metadata parameter block size
   as a floor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoTidy error messages for add_to_super failure.
NeilBrown [Thu, 27 Nov 2008 04:39:59 +0000 (15:39 +1100)] 
Tidy error messages for add_to_super failure.

Make sure every failure from add_to_super prints a suitable
error message, and then don't print any error in the caller.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoallow add_to_super to return errors
Dan Williams [Wed, 26 Nov 2008 22:39:51 +0000 (15:39 -0700)] 
allow add_to_super to return errors

Prepare add_to_super to validate disks against the platform capabilities

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoSupport --wait-clean --scan
Dan Williams [Wed, 26 Nov 2008 22:39:50 +0000 (15:39 -0700)] 
Support --wait-clean --scan

Its cumbersome to determine which devices to wait for in a system shutdown
script, so hook up --scan.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agosome warn_unused_result fixups
Dan Williams [Wed, 26 Nov 2008 18:25:10 +0000 (11:25 -0700)] 
some warn_unused_result fixups

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAssemble: don't auto-assemble if any arrays are listed in mdadm.conf
NeilBrown [Thu, 20 Nov 2008 06:02:55 +0000 (17:02 +1100)] 
Assemble: don't auto-assemble if any arrays are listed in mdadm.conf

Auto-assembly and planned assembly don't really work well together,
it can be confusing.
In particular in mkinitrd or similar creates an mdadm.conf to
assemble a particular array, we shouldn't go assembling any
other arrays as well.

If you want auto assembly, you need to give mdadm a config
file with no ARRAY lines.
  mdadm -Ascpartitions
can do this.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdmon: pass symbolic name to mdmon instead of device name.
NeilBrown [Thu, 20 Nov 2008 03:51:42 +0000 (14:51 +1100)] 
mdmon: pass symbolic name to mdmon instead of device name.

Now that names in /dev are usually created (eventually) by udev,
it isn't really safe to rely in finding a name in /dev to pass to
mdmon to identify which array to monitor.
And it isn't really necessary to have a name in /dev.
So just pass the symbolic name, e.g. md127 or md123.

Change util.c to pass that name, and change mdmon to process the
name sensibly.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agofix add_dev() handling of broken links
Dan Williams [Mon, 10 Nov 2008 16:30:07 +0000 (09:30 -0700)] 
fix add_dev() handling of broken links

Resolves issues like:
mdadm -Ss
mdadm: unable to open /dev/md/r1: No such file or directory

...where /dev/md/r1 points to a removed device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agofix remove_devices()
Dan Williams [Sat, 8 Nov 2008 23:03:07 +0000 (16:03 -0700)] 
fix remove_devices()

Don't write to 'pe' if 'path' was not specified

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix uuid_from_super given 'signature' is not constant
Dan Williams [Sat, 8 Nov 2008 23:03:07 +0000 (16:03 -0700)] 
imsm: fix uuid_from_super given 'signature' is not constant

The version portion of the signature changes depending on the contents
of the container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: compatibility fixes for creating imsm arrays
Dan Williams [Sat, 8 Nov 2008 23:03:07 +0000 (16:03 -0700)] 
imsm: compatibility fixes for creating imsm arrays

When creating an imsm array use the lowest possible feature set to
maximize compatibility.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fixup disk status definition endianess
Dan Williams [Sat, 8 Nov 2008 23:02:56 +0000 (16:02 -0700)] 
imsm: fixup disk status definition endianess

Change the multibyte disk status field definitions to imsm byte-order
(little-endian) to match other multibyte field definitions.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: add definitions for recent imsm versions
Dan Williams [Sat, 8 Nov 2008 22:47:39 +0000 (15:47 -0700)] 
imsm: add definitions for recent imsm versions

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: cleanup migration definitions and usage
Dan Williams [Fri, 7 Nov 2008 22:57:31 +0000 (15:57 -0700)] 
imsm: cleanup migration definitions and usage

imsm_set_array_state need not look at the map_state when failed==0

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: cleanup ->match_home and comment on return value
Dan Williams [Fri, 7 Nov 2008 22:08:09 +0000 (15:08 -0700)] 
imsm: cleanup ->match_home and comment on return value

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoCreate: don't wait for device to appear if we didn't actually start the array
NeilBrown [Fri, 7 Nov 2008 11:20:56 +0000 (22:20 +1100)] 
Create: don't wait for device to appear if we didn't actually start the array

Otherwise we get an unpleasant 2 second pause when array creation
fails.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: close mdfd before returning from assemble_container_content
NeilBrown [Fri, 7 Nov 2008 11:15:14 +0000 (22:15 +1100)] 
Assemble:  close mdfd before returning from assemble_container_content

This makes sure it is consistently closed.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: return correct status from assemble_container_content.
NeilBrown [Fri, 7 Nov 2008 10:39:23 +0000 (21:39 +1100)] 
Assemble:  return correct status from assemble_container_content.

Otherwise autoassembly can get confused.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: fix some auto-assemble bugs.
NeilBrown [Fri, 7 Nov 2008 10:16:38 +0000 (21:16 +1100)] 
Assemble: fix some auto-assemble bugs.

1/ when we choose not to use a device, must set ->used to 2, not 1.
2/ When we give up on a member, clear st and content.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdopen: typo in buffer-length for a sprintf.
NeilBrown [Fri, 7 Nov 2008 03:46:51 +0000 (14:46 +1100)] 
mdopen: typo in buffer-length for a sprintf.

That '10000' should have been '1000'.  Make it a 'sizeof' to avoid
such carelessness.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMakefile: install udev file into $DESTDIR
NeilBrown [Fri, 7 Nov 2008 03:46:50 +0000 (14:46 +1100)] 
Makefile: install udev file into $DESTDIR

Forgot the $DESTDIR in the install target :-(

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoA couple of bugfixes found by suse autobuilding:
NeilBrown [Fri, 7 Nov 2008 03:46:30 +0000 (14:46 +1100)] 
A couple of bugfixes found by suse autobuilding:

1/ ia64 appear to have __clone2, not clone.
2/ Including "++" in the arg to a macro is a bad thing to do.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRelease 3.0-devel2 mdadm-3.0-devel2
NeilBrown [Wed, 5 Nov 2008 06:14:06 +0000 (17:14 +1100)] 
Release 3.0-devel2

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMan pages: updates for container etc.
NeilBrown [Wed, 5 Nov 2008 06:03:51 +0000 (17:03 +1100)] 
Man pages:  updates for container etc.

Multiple updates to try to get up to date with current code.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoStop: drop any partitions that may be associated with an array when stopping it.
NeilBrown [Tue, 4 Nov 2008 10:56:42 +0000 (21:56 +1100)] 
Stop: drop any partitions that may be associated with an array when stopping it.

Not all kernels automatically discard partitions when the
array is stopped,  so call the RRPART ioctl to force it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoWait for name to appear after create/assemble etc.
NeilBrown [Tue, 4 Nov 2008 10:56:42 +0000 (21:56 +1100)] 
Wait for name to appear after create/assemble etc.

We don't really want mdadm to exit until udev has
created the names in /dev.  So wait.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomapfile: validate entries before they are returned.
NeilBrown [Tue, 4 Nov 2008 10:56:42 +0000 (21:56 +1100)] 
mapfile:  validate entries before they are returned.

It is possible for the mapfile to become wrong, and that gets
very confusing.  So validate entries before returning them.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotests/06name: adjust for homehost
NeilBrown [Tue, 4 Nov 2008 10:56:36 +0000 (21:56 +1100)] 
tests/06name: adjust for homehost

Now that we set homehost by default, adjust teh 06name test
accordingly.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotest: always start with a clean slate.
NeilBrown [Tue, 4 Nov 2008 10:06:00 +0000 (21:06 +1100)] 
test: always start with a clean slate.

To avoid confusion with old array, also zero superblocks
before starting a test.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoIncrmental: cope with udev slowness and errors in map file.
NeilBrown [Tue, 4 Nov 2008 10:01:56 +0000 (21:01 +1100)] 
Incrmental: cope with udev slowness and errors in map file.

If udev hasn't created the array yet, we might still want to
open it.  So open directly by major:minor.

Also, of array in map file doesn't appear to exist, do use
the name associated with it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAbort sysfs_read early if no device found.
NeilBrown [Tue, 4 Nov 2008 09:56:11 +0000 (20:56 +1100)] 
Abort sysfs_read early if no device found.

sysfs_read currently tried to look in sysfs even in no valid sys_name
was found.  Don't to that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdopen: only let numeric name set minor number if it doesn't cause a conflict.
NeilBrown [Tue, 4 Nov 2008 09:54:50 +0000 (20:54 +1100)] 
mdopen: only let numeric name set minor number if it doesn't cause a conflict.

So if the array with minor number matching the name of a new array
already exists, just assemble with a different minor number.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: we were missing a 'close'
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Assemble:  we were missing a 'close'

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agotest: make sure udev isn't opening a device before closing it.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
test: make sure udev isn't opening a device before closing it.

As we open and close so quickly, udev might still have the device
open.  so call udevsettle before stopping an array during testing.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMan page update for containers etc.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Man page update for containers etc.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoddf: store homehost information to allow smooth assembly.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
ddf:  store homehost information to allow smooth assembly.

When we create our own ddf array, store the homehost in the vendor
information so it can be so to ensure 'LOCAL' name choices.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoCreate: make sure chosen_name is used for array name generation in Create
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Create: make sure chosen_name is used for array name generation in Create

As with Assemble, one create_mddev has chosen a name, we should always
use that rather than the passed 'mddev'.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoCreate: Don't optimise resync as recovery when creating raid5 in a container.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Create:  Don't optimise resync as recovery when creating raid5 in a container.

As spares are treated quite differently in containers, we cannot
fake-up a spare to optimise initialisation for a raid5 in a container,
so disable that code for ->external arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdopen: use small sequence number for uniquifying array names.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
mdopen: use small sequence number for uniquifying array names.

Rather than appending the md minor number, we now append a small
sequence number to make sure name in /dev/md/ that aren't LOCAL are
unique.  As the map file is locked while we do this, we are sure
of no losing any races.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: revise detection of 'autoassemble' mode.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Assemble:  revise detection of 'autoassemble' mode.

We probably should pass a flag down saying 'this is auto-assembly',
but for now, if there is no identity information set, it must
be auto-assemble.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDDF: report member arrays in examine_brief.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
DDF: report member arrays in examine_brief.

Thus an auto-generated config file will list all the arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDDF: fix irregularities with retrieval of 'name' from metadata.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
DDF: fix irregularities with retrieval of 'name' from metadata.

It is only 16 bytes, not 32.  And is space padded, not nul terminated.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: allow members of containers to be assembled and auto-assembled.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Assemble: allow members of containers to be assembled and auto-assembled.

Try to treat members of containers much like other arrays for
assembly.
We still look through the list of devices for a match (it will be
the container), then find the relevant 'info' and try to assemble
the array.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: simplify test for reporting mismatches.
NeilBrown [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Assemble: simplify test for reporting mismatches.

Rather than open-coding a test of 'verbose' and 'inargv' in
multiple places, do it one and set a variable.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: block attempts to reassemble container members
Dan Williams [Tue, 4 Nov 2008 09:51:12 +0000 (20:51 +1100)] 
Assemble: block attempts to reassemble container members

Attempting to open(O_EXCL) each candidate device usually filters out all
busy raid components.  However, containers do not behave like components
and will return container_content that may describe active member
arrays.

This patch just adds a function that will be used to check if a
container member is busy.  It will be used shortly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: factor out assemble_container_content
Dan Williams [Tue, 4 Nov 2008 09:51:11 +0000 (20:51 +1100)] 
Assemble: factor out assemble_container_content

Factor out, from Incremental_container,  the code for assembling an
array based on information extracted from a container.  We will
shortly use this from Assemble too.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAssemble: revert preliminary -As support
Dan Williams [Tue, 4 Nov 2008 09:51:11 +0000 (20:51 +1100)] 
Assemble: revert preliminary -As support

I have seen the light.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAssemble: replace 'info' with 'content'
Dan Williams [Tue, 4 Nov 2008 09:51:06 +0000 (20:51 +1100)] 
Assemble: replace 'info' with 'content'

In preparation for handling the container case where we may need to handle
a list of potential member arrays.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoconfig: add containers to the default search list
Dan Williams [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
config: add containers to the default search list

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoconfig: add 'containers' as a DEVICE keyword
Dan Williams [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
config: add 'containers' as a DEVICE keyword

Add anything that looks like a container in /proc/mdstat to the devlist

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoimsm: display container uuid in detail_super
Dan Williams [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
imsm: display container uuid in detail_super

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoimsm: display member array uuid in examine_super_imsm
Dan Williams [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
imsm: display member array uuid in examine_super_imsm

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoQuiet unitialized variable warnings
Dan Williams [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Quiet unitialized variable warnings

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoIncremental: lock against multiple concurrent additions to an array.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Incremental:  lock against multiple concurrent additions to an array.

In two devices are added via -I to one array at the same time, mdadm
can get badly confused.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoDetail: support MD_DEVNAME in --export for metadata-less devices.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Detail: support MD_DEVNAME in --export for metadata-less devices.

If there is no metadata (--build was used) then we need to lookup
by devnum, not by uuid, to get the map entry.

Signed-off-by: NeilBrown <neilb@suse.de>