]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
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>
15 years agoIncremental: fix setting of 'autof' flag.
NeilBrown [Wed, 29 Oct 2008 22:34:06 +0000 (09:34 +1100)] 
Incremental:  fix setting of 'autof' flag.

When doing auto-assembly, the 'autof' flag from array lines
in mdadm.conf was being ignored.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix --incremental assembly of partitions arrays.
NeilBrown [Wed, 29 Oct 2008 22:34:04 +0000 (09:34 +1100)] 
Fix --incremental assembly of partitions arrays.

If incremental assembly finds an array mentioned in mdadm.conf,
with a 'standard partitioned' name like /dev/md_d0 or /dev/md/d0,
it will not create a partitioned array like it should.
This is because it mishandled the 'devnum' returned by
is_standard.
That is a devnum that does not have the partition-or-not encoded
into it.  So we need to check the actual return value of
is_standard and encode the partition-or-not info into the devnum.

Also fix a couple of comments.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix NULL pointer oops
Doug Ledford [Wed, 29 Oct 2008 19:05:36 +0000 (15:05 -0400)] 
Fix NULL pointer oops

RAID10 is the only raid level that uses the avail char array pointer
during the enough() operation, so it was the only one that saw this.
The code in incremental assumes unconditionally that count_active will
allocate the avail char array, that it might be used by enough, and that
it will need to be freed afterward.  Once you make count_active actually
do that, then the oops goes away.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix bad metadata formatting
Doug Ledford [Wed, 29 Oct 2008 19:05:35 +0000 (15:05 -0400)] 
Fix bad metadata formatting

Certain operations (Detail.c mainly) would print out the metadata of
an array in a format that the scan operation in super0.c and super1.c
would later reject as unknown when it was found in the mdadm.conf file.
Use a consistent format, but also modify the super0 and super1 match
methods to accept the other format without complaint.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoPreliminary -As support for container member arrays
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
Preliminary -As support for container member arrays

Given an mdadm.conf like the following allow /dev/imsm and /dev/md/r1 to be
created by "mdadm -As".

DEVICES partitions
ARRAY /dev/imsm metadata=imsm auto=md UUID=b98f5dbe-aa859e7b-0e369b89-a80986d4
ARRAY /dev/md/r1 container=/dev/imsm member=0 auto=mdp UUID=3538e39c-b397c2e9-1aa031f9-2bc0eca4
   spares=1

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: include members in ->brief_examine
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
imsm: include members in ->brief_examine

A prerquisite for getting imsm arrays assembled by mdadm -As.

15 years agoimsm: copy raid device info when associating spares
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
imsm: copy raid device info when associating spares

If a spare is included in the list of examined disks we need to copy in at
least enough information to get the uuid of the populated container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: return associated uuid for spares
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
imsm: return associated uuid for spares

This prevents a uuid of all f's from being displayed when an imsm spare is
listed along with active disks for mdadm -Eb.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoExamine: fix MD_DISK_SYNC is a bit not a flag
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
Examine: fix MD_DISK_SYNC is a bit not a flag

Examine() is actually looking at the ACTIVE bit.  This happened to work for
imsm spares but now it needs to be fixed up.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: update metadata immediately on "add spare" events
Dan Williams [Tue, 28 Oct 2008 17:55:31 +0000 (10:55 -0700)] 
imsm: update metadata immediately on "add spare" events

...without this the spare record is delayed until the next metadata
event.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoupdate copyright headers
Dan Williams [Tue, 28 Oct 2008 17:55:29 +0000 (10:55 -0700)] 
update copyright headers

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Sun, 26 Oct 2008 23:10:08 +0000 (10:10 +1100)] 
Merge branch 'master' into devel-3.0

Conflicts:

Create.c
Manage.c

15 years agoddf: get endian-ness of CRC correct.
NeilBrown [Sun, 26 Oct 2008 23:04:46 +0000 (10:04 +1100)] 
ddf: get endian-ness of CRC correct.

All numeric fields in a DDF header big-endian, including the CRC, so
better fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMakefile: Include bitmap.o in mdmon
NeilBrown [Sun, 26 Oct 2008 22:57:30 +0000 (09:57 +1100)] 
Makefile: Include bitmap.o in mdmon

A recent change causes mdmon to appear to need 'bitmap_sectors', which
is in bitmap.o.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAllow WRITEMOSTLY to be cleared on --readd using --readwrite.
NeilBrown [Sat, 25 Oct 2008 07:20:49 +0000 (18:20 +1100)] 
Allow WRITEMOSTLY to be cleared on --readd using --readwrite.

Previously it was possible to set the WRITEMOSTLY flag when
adding a device to an array, but not to clear the flag when re-adding.
This is now possible with --readwrite.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMerge branch 'master' into devel-3.0
NeilBrown [Fri, 17 Oct 2008 01:46:23 +0000 (12:46 +1100)] 
Merge branch 'master' into devel-3.0

Conflicts:

Manage.c

15 years agoRemove .UR .UE macros from man page because the don't do what we want.
NeilBrown [Fri, 17 Oct 2008 00:52:38 +0000 (11:52 +1100)] 
Remove .UR .UE macros from man page because the don't do what we want.

.UR URL
text
.UE

is meant to create a hyperlink from the 'text' to the 'URL'.
But I wanted just to have the URL, so UR isn't really the right
tool - the URL gets displayed twice.

So just display the URL in bold and assume man2html etc can recognise
it and do the right thing.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdmon: suicide prevention
Dan Williams [Fri, 3 Oct 2008 05:26:00 +0000 (22:26 -0700)] 
mdmon: suicide prevention

mdmon cannot remove the pidfile at shutdown becuase it needs to stay
running across the "mount -o remount,ro /" event.  When it relaunches
after a reboot there is a good chance that the pid will match what was
there previously.  The result is that the "take over for unresponsive
mdmon" logic results in self termination.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoquiet WaitClean()
Dan Williams [Thu, 2 Oct 2008 23:07:21 +0000 (16:07 -0700)] 
quiet WaitClean()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: --switch-root
Dan Williams [Thu, 2 Oct 2008 22:50:23 +0000 (15:50 -0700)] 
mdmon: --switch-root

For raid rootfs we cannot run the array unmonitored for any length of
time.  At least XFS will not mount/replay the journal if the underlying
block device is readonly (FIXME it also seems that XFS does not always
honor the ro status of the backing device as I was able to hit the
BUG_ON(mddev->ro == 1) in md_write_start... but I digress).

So we need to start mdmon in the initramfs before '/' is mounted and
then restart it after the real rootfs is available.  Upon seeing the
--switch-root option, mdmon will kill any victims in the current
/var/run/mdadm directory and then chroot(2) before continuing.

The option is deliberately called 'switch-root' instead of 'chroot' to
hopefully indicate that this is different than doing "chroot mdmon
/dev/imsm".

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: wait after trying to kill
Dan Williams [Thu, 2 Oct 2008 22:42:57 +0000 (15:42 -0700)] 
mdmon: wait after trying to kill

Now that mdmon handles sigterm if another monitor wants to take over it
should wait until all managed arrays are clean.  So make WaitClean()
available to mdmon and teach try_kill_monitor() to wait on each subarray
in the container.

...since we may be communicating with a dieing process, we need to
block SIGPIPE earlier.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: terminate clean
Dan Williams [Thu, 2 Oct 2008 13:32:08 +0000 (06:32 -0700)] 
mdmon: terminate clean

We generally don't want mdmon to be terminated, but if a SIGTERM gets
through try to leave the monitored arrays in a clean state, block
attempts to mark the array dirty, and stop servicing the socket.

When we are killed by sigterm don't remove the pidfile let that be
cleaned up by the next monitor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoTreat all devices at the container level as spares
Dan Williams [Thu, 2 Oct 2008 01:50:44 +0000 (18:50 -0700)] 
Treat all devices at the container level as spares

Raid disk and disk number information is not relevant at the container
level, especially for imsm.  So arrange for getinfo_super_imsm() to
always publish devices as spares and report the number of spares at
Assemble() time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAllow a uuid of all f's to always match
Dan Williams [Thu, 2 Oct 2008 01:50:44 +0000 (18:50 -0700)] 
Allow a uuid of all f's to always match

The uuid returned for an imsm spare device will never match the uuid of an
active disk.  So make mdadm interpret a uuid of all f's as "match any".

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: show uuid in ->examine_super()
Dan Williams [Thu, 2 Oct 2008 01:50:43 +0000 (18:50 -0700)] 
imsm: show uuid in ->examine_super()

...and add "auto=md" to the brief output.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agofname_as_uuid: print uuids msb first
Dan Williams [Thu, 2 Oct 2008 01:50:43 +0000 (18:50 -0700)] 
fname_as_uuid: print uuids msb first

The sha1 routines store the uuids in little endian byte-order, so always
print from msb to lsb. This allows imsm containers to be assembled with
-As.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: periodically retry to create the socket
Dan Williams [Thu, 2 Oct 2008 01:50:43 +0000 (18:50 -0700)] 
mdmon: periodically retry to create the socket

If initial socket creation fails, EROFS, set a periodic alarm to wake up
the manager and retry.  Include a kernel patch that will wake us up if
the mount flags are changed.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>