]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
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>
15 years agoManage: when stopping an array, delete all names from /dev.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Manage: when stopping an array, delete all names from /dev.

This only applies if udev isn't installed or is disabled
by MDADM_NO_UDEV
We try to remove partitions too.
We find names to remove by looking in /var/run/mdadm/map

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoassemble: fix setting of 'foreign' trustability.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
assemble:  fix setting of 'foreign' trustability.

15 years agomdopen: fix up name parsing.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
mdopen:  fix up name parsing.

I think this is closer to what I want.  Fewer surprises anyway.

15 years agoAssemble: Fix naming of container devices.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Assemble: Fix naming of container devices.

Container devices are meant to be named for the metadata type.
That wasn't happening properly for DDF.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoGenerate 'change' uevents when arrays change in non-obvious ways.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Generate 'change' uevents when arrays change in non-obvious ways.

When a 'container' gets started, we need udev to notice, but the
kernel has no way of knowing that a KOBJ_CHANGE event is needed.  So
send one directly via the 'uevent' sysfs attribute.

Also, uevents don't get generated when md arrays are stopped (prior to
2.6.28) so send 'change' events then too.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAdd udev rules file for mdadm.
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
Add udev rules file for mdadm.

This is based on the rules from openSUSE 11.1-rc3.

15 years agodetail: --export also provided MD_DEVNAME
NeilBrown [Tue, 4 Nov 2008 09:50:39 +0000 (20:50 +1100)] 
detail:  --export also provided MD_DEVNAME

MD_NAME is the name of the array extracted directly from the metadata.
MD_DEVNAME is the current working name of the array.  It should appear
in /dev/md.  It is possibly what the user gave when creating the
array.
We extract it from /var/run/mdadm/map.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAlways update mdadm/map when starting an array.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
Always update mdadm/map when starting an array.

We previously only updated /var/run/mdadm/map when starting an
array with --incremental.  However we now make more use of
that file (to pass the dev name to udev) so always update it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAlways set 'homehost' if not specified.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
Always set 'homehost' if not specified.

The default for 'homehost' is now '<system>' rather than
unspecified.

15 years agoDon't give array name in --examine --brief output if it is doubtful.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
Don't give array name in --examine --brief output if it is doubtful.

Now that mdadm.conf doesn't need an array name, we don't need to
give one if the array cannot reliably provide one.

15 years agoconfig: Support container=uuid as alternative to container=/dev/name in mdadm.conf
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
config: Support container=uuid as alternative to container=/dev/name in mdadm.conf

When mdadm.conf is automatically generated, we might not know a
suitable /dev/name.  But we do know the uuid of the container.
So allow that as an option.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoconfig: Don't require an array to have a device name.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
config:  Don't require an array to have a device name.

i.e. in mdadm.conf you can have a line like

   ARRAY uuid=whatever

and it will use auto-name-generation to give a name to the array at
assemble-time.  The is different from blind auto-assembly in that the
array will be treated as 'local'.

15 years agoIncremental: adjust to the new naming scheme.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
Incremental: adjust to the new naming scheme.

--incremental now uses exactly the same create_mddev that
other code uses.

15 years agomdopen: Restore creation of partition devices and symlink.
NeilBrown [Tue, 4 Nov 2008 09:50:38 +0000 (20:50 +1100)] 
mdopen:  Restore creation of partition devices and symlink.

Using the 'new' name scheme we restore the creation of partition
links (in the case the udev isn't used).

15 years agomdopen: Introduce new rules for creating device name.
NeilBrown [Tue, 4 Nov 2008 09:50:21 +0000 (20:50 +1100)] 
mdopen:  Introduce new rules for creating device name.

MORE CONTENT HERE

15 years agoutil: make env checking more generic
NeilBrown [Mon, 3 Nov 2008 23:35:43 +0000 (10:35 +1100)] 
util: make env checking more generic

Change the "env_check_mdmon" function to be more generic, accepting
and environment variable name, as soon we will have a new use for it.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoassemble: combine the two create_mddev calls in to one.
NeilBrown [Mon, 3 Nov 2008 23:35:42 +0000 (10:35 +1100)] 
assemble:  combine the two create_mddev calls in to one.

This delays the create_mddev call even further in the case where
an array device name is given for --assemble.  It is now delayed
until the 'name' of the array is also available.

15 years agointel: Avoid 'may be used before initialised' warning.
NeilBrown [Mon, 3 Nov 2008 23:35:40 +0000 (10:35 +1100)] 
intel: Avoid 'may be used before initialised' warning.

When compile with -Os, the compile doesn't work out that the
variable is always initialised before usage, so we tell it.

15 years agoDelay creation of array devices for assemble/build/create
NeilBrown [Mon, 3 Nov 2008 23:35:37 +0000 (10:35 +1100)] 
Delay creation of array devices for assemble/build/create

We will shortly be feeding more information into the process of
creating array devices, so delay the creation.  Still open them
early if the device already exists.

This involves making sure the autof flag is in the right place
so that it can be found at creation time.

Also, Assemble, Build, and Create now always close 'mdfd'.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAvoid opening md device twice in particular '--assemble' instance.
NeilBrown [Mon, 3 Nov 2008 23:35:35 +0000 (10:35 +1100)] 
Avoid opening md device twice in particular '--assemble' instance.

When
   mdadm --assemble /dev/whatever

is given, mdadm will treat it as though '--scan' were given, even
though it wasn't.
In this case, the code opens /dev/whatever twice, which is pointless.
We already know /dev/whatever is open at this point, so remove the
'open' and the tests, and make sure it is always closed afterwards.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoIntroduce new open_mddev which just does an open.
NeilBrown [Mon, 3 Nov 2008 23:35:31 +0000 (10:35 +1100)] 
Introduce new open_mddev which just does an open.

Some cases we aren't interested in creating the mddev, just opening
it.  Make those more explicit.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoRename open_mddev to create_mddev
NeilBrown [Mon, 3 Nov 2008 23:35:10 +0000 (10:35 +1100)] 
Rename open_mddev to create_mddev

This reflect that fact that more often than not it is creating things
in /dev, and allows for a new open_mddev which does just that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoInitialise ->container and ->member properly.
NeilBrown [Mon, 3 Nov 2008 23:35:09 +0000 (10:35 +1100)] 
Initialise ->container and ->member properly.

Now that we are using these values, we need to initialise them
properly.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMove recently merged /sys/dev/ lookup into stat2devnum.
NeilBrown [Mon, 3 Nov 2008 23:35:08 +0000 (10:35 +1100)] 
Move recently merged /sys/dev/ lookup into stat2devnum.

But sysfs_init and stat2devnum try to convert stat information
into an md devnum.  Combine all the value of both pieces of code
into stat2devnum and have sysfs_init call that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agocleanup an unused call to container2devname
Dan Williams [Mon, 3 Nov 2008 23:34:53 +0000 (10:34 +1100)] 
cleanup an unused call to container2devname

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'master' into scratch-3.0
NeilBrown [Sun, 2 Nov 2008 20:20:54 +0000 (07:20 +1100)] 
Merge branch 'master' into scratch-3.0

15 years agomapfile: fix bug in testing for /var/run/mdadm/
NeilBrown [Sun, 2 Nov 2008 20:19:37 +0000 (07:19 +1100)] 
mapfile:  fix bug in testing for /var/run/mdadm/

There was a bug.  If /var/run/mdadm/ did not exist as a directory,
the map file should have been created in /var/run/mdadm.map, but
due to bug it would never get created.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'master' into scratch-3.0
NeilBrown [Sun, 2 Nov 2008 19:40:12 +0000 (06:40 +1100)] 
Merge branch 'master' into scratch-3.0

15 years agoIncremental: change precedence order for autof setting.
NeilBrown [Sun, 2 Nov 2008 19:39:02 +0000 (06:39 +1100)] 
Incremental:  change precedence order for autof setting.

It doesn't really make sense for the --auto setting to ever over-ride
the setting on an ARRAY line.  That could cause failure if the
ARRAY line has a 'standard' now.  So revert to the array line having
precedence over command line, then CREATE line last.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Thu, 30 Oct 2008 06:02:49 +0000 (17:02 +1100)] 
Merge branch 'master' into devel-3.0

15 years agoAdjust major number testing to allow for extended minor number in 2.6.28
NeilBrown [Thu, 30 Oct 2008 05:37:29 +0000 (16:37 +1100)] 
Adjust major number testing to allow for extended minor number in 2.6.28

From 2.6.28, normal md device will be able to have partitions.  These
partitions will have a different major number.  Sometimes mdadm tests
the major number and so can get confused.
Change these tests to test against get_mdp_major().  mdp does not use
extended minor number and so this test will always be accurate.

Also use /sys/dev links to map major/minor to devnum in sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Thu, 30 Oct 2008 02:59:11 +0000 (13:59 +1100)] 
Merge branch 'master' into devel-3.0

Conflicts:

Incremental.c
super0.c
super1.c

15 years agoIncremental: allow assembly of foreign array.
NeilBrown [Wed, 29 Oct 2008 22:48:18 +0000 (09:48 +1100)] 
Incremental:  allow assembly of foreign array.

If a foreign (i.e. not known to be local) array is discovered
by --incremental assembly, we now assemble it.  However we ignore
any name information in the array so as not to potentially create
a name that conflict with a 'local' array.
Also, foreign arrays are always assembled 'read-auto' to avoid writing
anything until the array is actually used.

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