Change "mdadm --run" to use the same code as "mdadm --IRs".

Current "mdadm --run /dev/mdX" will not handle external metadata
properly.  mdmon won't be started etc.

So use the code from "mdadm -IRs" instead - that already does all
the right things.

Reported-by: Francis Moreau <francis.moro@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Add raid6check to .gitignore

Signed-off-by: NeilBrown <neilb@suse.de>
Add ANNOUNCE-3.2.6 from different branch

just for completeness...

Signed-off-by: NeilBrown <neilb@suse.de>
DDF: ddf_activate_spare: fix gcc -O2 uninitialized warning

At this point 'di' and 'rv' both have the same value.  gcc doesn't
realise that and a human reader might not either.
'rv' makes more sense too, so use that.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
DDF: export_examine_super_ddf: print MD_DEVICES

Have mdadm -E --export print the number of RAID devices,
like other meta data formats do. Anaconda (RHEL/CentOS installer)
depends on it.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
DDF: container_content_ddf: set safe_mode_delay > 0

Set safe_mode_delay to something >0, otherwise all container subarrays
assembled will have safe_mode_delay=0. That will break the assumption that
meta data becomes clean after running mdadm --wait-clean.

Use the same value as in getinfo_super_ddf_bvd. It would be cleaner
to call that directly from container_content_ddf, but I need to check
possible side effects first.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
DDF: increase default value for safe_mode_delay to 4000ms

That is the same value that IMSM uses. The current default of 200ms
seems to have been copied from the native MD meta data. That value
appears to be much too low for DDF, given that writing the DDF meta
data means that easily several MB worth of data need to be written to
disk.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
in_initrd: fix gcc compiler error

On some systems, this code caused a "comparison between signed
and unsigned" error.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow: fix hang when growing a RAID5.

Since:

commit 84d11e6c6a3b827b2daa32e16303235ce33d49f5
Author: NeilBrown <neilb@suse.de>
Date:   Thu Aug 1 11:16:14 2013 +1000

    Grow: exit background thread cleanly on SIGTERM.

removed the setting of "sync_max" from abort_reshape() we need
to do it explicitly here.

Signed-off-by: NeilBrown <neilb@suse.de>
Make sure "mdmon" doesn't get called "@dmon".

The Anaconda installer (via its "loader" program) will try to kill
many processes at shutdown, but not "mdmon".

However when mdadm runs mdmon in the Anaconda environment, mdmon
sets argv[0][0] to '@' resulting in "@dmon" which confuses
"loader".

So change mdadm to set argv[0] to a path so that mdmon becomes e.g.
  "@usr/sbin/mdmon"
which "loader" will recognise as being "mdmon".

Reported-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
Assemble: don't ever consider a 'spare' to be the 'most recent'.

If all devices have the same event count and the first one is a spare,
then that spare will be the 'most_recent'.
However then other devices will think the 'most_recent' has failed
(for v0.90 metadata) and will be rejected from the array.

So never consider a 'spare' to be 'most recent'.

Reported-by: Andreas Baer <synthetic.gods@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
mdmon: make sure we set safe_mode on SIGTERM.

Without this, array may not go clean and mdmon will then
not exit.

A safe_mode of '0' (which is the only one that is handled differently
by this patch) means "never switch to 'active_idle'".  We don't want
that when mdmon is stopping.

Signed-off-by: NeilBrown <neilb@suse.de>
Config: factor reading of file out into separate function.

This will make it easier to read multiple files in a conf.d/

Signed-off-by: NeilBrown <neilb@suse.de>
Conf: allow conf file to be a directory.

If config file is a directory, process each file within with a name
ending in ".conf" that doesn't start with ".".
Files are processed in lexical order.

Signed-off-by: NeilBrown <neilb@suse.de>
config: read /etc/mdadm.conf.d as well as /etc/mdadm.conf

If a configfile is explicitly given, just that file or directory
is read. Otherwise we now read both a file
  /etc/mdadm.conf
and a directory
  /etc/mdadm.conf.d

This allows a transition to directory based config, which in turn
allows easy control from scripts.

Signed-off-by: NeilBrown  <neilb@suse.de>
Config: multiple occurences of lines is not an error.

As we now support config directories it is helpful if
lines are allowed to occur multiple times with one
over-riding the other.
So stop giving warnings when later lines are ignored.

Signed-off-by: NeilBrown <neilb@suse.de>
config: refactor load_conffile() to have a single exit.

This will make next patch cleaner.
No functional change.

Signed-off-by: NeilBrown <neilb@suse.de>
config: support MDADM_CONF_AUTO= env var.

If a distribution allows the choice between using mdadm and
dmraid for DDF and IMSM to be made by some config file
(/etc/defaults/ /sys/sysconfig/ etc) which is queried by
/etc/init.d scripts, then the fact that mdadm implements this
choce through the config file is not very helpful.

So allow the "AUTO" line to be specified in part using MDADM_CONF_AUTO
in environment.

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

(and  various cosmetic fixes)

Signed-off-by: NeilBrown <neilb@suse.de>
Minor fixes in mdadm.conf.5 man page.

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