]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
14 years agoGrow: use large block count and make sure stripe cache can hold it.
NeilBrown [Fri, 6 Nov 2009 03:48:10 +0000 (14:48 +1100)] 
Grow: use large block count and make sure stripe cache can hold it.

The bigger the backup is, the fast it goes to some extend.

16Meg is fairly arbitrary

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: get component_size before using it.
NeilBrown [Fri, 6 Nov 2009 03:18:49 +0000 (14:18 +1100)] 
Grow: get component_size before using it.

We were using ->component_size while it hadn't been set.
This effectively meant that 'blocks' wasn't multiplied by
16 and reshape was even slower than it should have been.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: handle array going degraded during reshape.
NeilBrown [Fri, 6 Nov 2009 02:56:05 +0000 (13:56 +1100)] 
Grow: handle array going degraded during reshape.

If an array goes degraded during reshape, we need to
adjust the devices we read from so as not to back up
stale data.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: restore backup to proper location.
NeilBrown [Fri, 6 Nov 2009 02:38:43 +0000 (13:38 +1100)] 
Grow: restore backup to proper location.

The 'arraystart' is in sectors while restore_stripes requires
bytes, so we need a conversion.

Without this, backups get restored to the wrong offset.

Reported-by: "KueiHuan Chen" <kueihuan.chen@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agovol_id was removed by the udev upstream maintainer in May 2009.
Marco d'Itri [Wed, 28 Oct 2009 23:14:43 +0000 (10:14 +1100)] 
vol_id was removed by the udev upstream maintainer in May 2009.

One should use
  /sbin/blkid -o udev -p ...
(from util-linux >> 2.16) instead of
  vol_id --export ...

Author: Marco d'Itri <md@linux.it>
Bug-Debian: http://bugs.debian.org/541884
Reviewed-by: martin f. krafft <madduck@debian.org>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRemove bogus warnings from man page.
NeilBrown [Wed, 28 Oct 2009 23:11:01 +0000 (10:11 +1100)] 
Remove bogus warnings from man page.

LANG=C man --warnings -l mdadm.8 > /dev/null

complains that '.XX' is an invalid macro.
This is not correct.  The sequence

   .ig XX
   anything can go here
   .XX

is correct and is ignored (see 'info groff' and the 'ig' index
entry).

However the same can be achieved with
   .ig
   anything can go there
   ..

and this produces no warnings, so use that instead.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoDetail: report new-layout for RAID6 arrays
NeilBrown [Wed, 28 Oct 2009 23:02:24 +0000 (10:02 +1100)] 
Detail: report new-layout for RAID6 arrays

We were only reporting it for RAID5 and RAID10.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRelease 3.1 mdadm-3.1
NeilBrown [Thu, 22 Oct 2009 03:07:05 +0000 (14:07 +1100)] 
Release 3.1

New functionality in --grow.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' into devel-3.1
NeilBrown [Thu, 22 Oct 2009 02:57:54 +0000 (13:57 +1100)] 
Merge branch 'master' into devel-3.1

14 years agoRelease 3.0.3 mdadm-3.0.3
NeilBrown [Thu, 22 Oct 2009 01:05:22 +0000 (12:05 +1100)] 
Release 3.0.3

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' into devel-3.1
NeilBrown [Thu, 22 Oct 2009 00:13:13 +0000 (11:13 +1100)] 
Merge branch 'master' into devel-3.1

14 years agoFree some malloced memory that wasn't being freed.
NeilBrown [Thu, 22 Oct 2009 00:00:56 +0000 (11:00 +1100)] 
Free some malloced memory that wasn't being freed.

As mdadm is normally a short-lived program it isn't always necessary
to free memory that was allocated, as the 'exit()' call will
automatically free everything.  But it is more obviously correct if
the 'free' is there.
So this patch add a few calls to 'free'

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: update backup-metadata mtime every time we write it.
NeilBrown [Wed, 21 Oct 2009 23:42:06 +0000 (10:42 +1100)] 
Grow: update backup-metadata mtime every time we write it.

Originally the backup-metadata was only written once at the
start of a raid5 reshape that made the array bigger.  So we only
set the mtime once.

Now that we can be writing metadata continually during an in-place
reshape, we need to update the mtime more often.

Also, allow the metadata mtime to be slightly in advance of the
array mtime.  Normally the difference will be less than a second,
so 10 minutes should be plenty.  This guards against an old backup
file being used to restart an array.  but starting two reshapes in the
10 minutes is sufficiently unlikely, and the possibility of an
accident is already sufficiently small, that 10 minutes is probably
fine.

Thanks to Guy Martin <gmsoft@tuxicoman.be> for discovering and
reporting that .mtime wasn't being updated properly.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoCompile fixes for mdassemble
NeilBrown [Tue, 20 Oct 2009 05:53:43 +0000 (16:53 +1100)] 
Compile fixes for mdassemble

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: reject raid-disks reduction in RAID5 etc before 2.6.32
NeilBrown [Tue, 20 Oct 2009 05:36:03 +0000 (16:36 +1100)] 
Grow: reject raid-disks reduction in RAID5 etc before 2.6.32

2.6.31 has some bugs with restarting a RAID5 reduction, so
refuse to try unless at least 2.6.32.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAssemble: print more verbose messages about restarting a reshape
NeilBrown [Tue, 20 Oct 2009 05:23:45 +0000 (16:23 +1100)] 
Assemble: print more verbose messages about restarting a reshape

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAdd missing 'continue' in Grow_restart.
NeilBrown [Tue, 20 Oct 2009 04:36:49 +0000 (15:36 +1100)] 
Add missing 'continue' in Grow_restart.

Thus we weren't checking the uuid properly.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agosuper-intel: Fix compilation of mdassemble.
NeilBrown [Tue, 20 Oct 2009 02:50:23 +0000 (13:50 +1100)] 
super-intel:  Fix compilation of mdassemble.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotestreshape5 fixes.
NeilBrown [Mon, 19 Oct 2009 21:02:53 +0000 (08:02 +1100)] 
testreshape5 fixes.

We seem to need a 'udevadm settle', and possibly the 'sync'..

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotests/imsm: allow for rounding of array size.
NeilBrown [Fri, 16 Oct 2009 06:57:28 +0000 (17:57 +1100)] 
tests/imsm:  allow for rounding of array size.

IMSM rounds array size to a multiple of 1024K, so our tests must
assume this.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdopen: only use 'dev' as chosen name if it is a full path.
NeilBrown [Mon, 19 Oct 2009 06:11:15 +0000 (17:11 +1100)] 
mdopen: only use 'dev' as chosen name if it is a full path.

Otherwise using names like "r0" causes problem.  They are
handled sufficiently by other paths in the code.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAssemble: handle container members better
NeilBrown [Mon, 19 Oct 2009 06:08:04 +0000 (17:08 +1100)] 
Assemble: handle container members better

When looking for a specific member, don't accept a
different member, but step on to the next one.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAssemble: print verbose messages when finding members in containers
NeilBrown [Mon, 19 Oct 2009 06:04:12 +0000 (17:04 +1100)] 
Assemble: print verbose messages when finding members in containers

.. so that "-Av" gives more hints at what is going on.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoDetail: list containers before members.
NeilBrown [Mon, 19 Oct 2009 06:00:52 +0000 (17:00 +1100)] 
Detail: list containers before members.

To allow "--assemble --scan" to have a chance, list
containers before members in --detail --scan output.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotest/ddf: don't insist that mdadm.conf is always in the same order.
NeilBrown [Mon, 19 Oct 2009 05:58:38 +0000 (16:58 +1100)] 
test/ddf:  don't insist that mdadm.conf is always in the same order.

When created by different process, the order could reasonably
be different.  So sort before compare

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotest/raid6integ: correct type
NeilBrown [Mon, 19 Oct 2009 05:57:16 +0000 (16:57 +1100)] 
test/raid6integ: correct type

ddf-zero-restart was misspelled.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotest: udev-settle before testing device.
NeilBrown [Mon, 19 Oct 2009 05:56:13 +0000 (16:56 +1100)] 
test: udev-settle before testing device.

I think we sometime get way ahead of udev and devices disappear
and appear almost at random.  So add some settling.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdadm(8): fix spurious space after -e header
Mike Frysinger [Sun, 4 Oct 2009 00:34:55 +0000 (20:34 -0400)] 
mdadm(8): fix spurious space after -e header

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMonitor: add option to specify rebuild increments
Zdenek Behan [Mon, 19 Oct 2009 02:13:58 +0000 (13:13 +1100)] 
Monitor: add option to specify rebuild increments

ie. the percent increments after which RebuildNN event is generated

This is particulary useful when using --program option, rather than
(only) syslog for alerts.

Signed-off-by: Zdenek Behan <rain@matfyz.cz>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdmon: lock current memory as well as future memory.
NeilBrown [Mon, 19 Oct 2009 02:04:16 +0000 (13:04 +1100)] 
mdmon: lock current memory as well as future memory.

mlockall(MCL_FUTURE) only locks mappings that have not yet
been created.  To lock all memory used by the process, we need
 MCL_CURRENT | MCL_FUTURE

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge git://github.com/djbw/mdadm
NeilBrown [Mon, 19 Oct 2009 01:52:58 +0000 (12:52 +1100)] 
Merge git://github.com/djbw/mdadm

14 years agotests/imsm: allow for rounding of array size.
NeilBrown [Fri, 16 Oct 2009 06:57:28 +0000 (17:57 +1100)] 
tests/imsm:  allow for rounding of array size.

IMSM rounds array size to a multiple of 1024K, so our tests must
assume this.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoTest different r5/r6 layouts.
NeilBrown [Fri, 16 Oct 2009 06:50:07 +0000 (17:50 +1100)] 
Test different r5/r6 layouts.

Make sure kernel and restripe agree on all different layouts.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agorestripe: fix assignment of raid6 blocks for syndrome calculation.
NeilBrown [Fri, 16 Oct 2009 06:50:06 +0000 (17:50 +1100)] 
restripe: fix assignment of raid6 blocks for syndrome calculation.

Particularly for the _6 style.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoHandle negative delta_disks in super0 and super1.
NeilBrown [Fri, 16 Oct 2009 06:43:54 +0000 (17:43 +1100)] 
Handle negative delta_disks in super0 and super1.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow_restart to handle reducing number of devices in an array.
NeilBrown [Fri, 16 Oct 2009 06:43:51 +0000 (17:43 +1100)] 
Grow_restart to handle reducing number of devices in an array.

FIXME this is wrong . what direction does reshape_position move?

If the device count in an array is shrinking, the critical
region is different so the tests need to be different when
restarting.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: don't make 'blocks' too large during in-place reshape.
NeilBrown [Fri, 16 Oct 2009 06:02:34 +0000 (17:02 +1100)] 
Grow: don't make 'blocks' too large during in-place reshape.

On small (test) arrays, multiplying by 16 can make the 'chunk' size
larger than half the array, which is a problem.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdmon: preserve socket over chroot
Dan Williams [Wed, 14 Oct 2009 00:37:02 +0000 (17:37 -0700)] 
mdmon: preserve socket over chroot

Connect to the monitor in the old namespace and use that connection for
WaitClean requests when stopping the victim mdmon instance.  This allows
ping_monitor() to work post chroot().

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agomdmon: exec(2) when the switchroot argument is not "/"
Dan Williams [Wed, 14 Oct 2009 00:08:33 +0000 (17:08 -0700)] 
mdmon: exec(2) when the switchroot argument is not "/"

Try to execute mdmon from the target namespace.  When used for initramfs
handovers we need to drop all references to the initramfs filesystem for
that memory to be freed.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agomdmon: avoid writes in the startup path for mdmon on root arrays
Dan Williams [Wed, 14 Oct 2009 00:41:57 +0000 (17:41 -0700)] 
mdmon: avoid writes in the startup path for mdmon on root arrays

When killing a previous monitor be careful not to cause writes to the
filesystem until the reads necessary to get the monitor operational have
completed.

The code is already prepared for errors creating the pid and socket
files, so simply defer creation of these files until after the first
call to manage().

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoDetail: export MD_UUID from mapfile
Dan Williams [Wed, 14 Oct 2009 00:41:57 +0000 (17:41 -0700)] 
Detail: export MD_UUID from mapfile

The load_super() from an mdadm --detail call may race against an mdmon
update.  When this happens the load_super sees an inconsistent metadata
block and returns an error.  The fallback path to use the map file
contents lacks uuid reporting, so provide __fname_from_uuid for
generically printing a uuid.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: regression test for prodigal array member scenario
Dan Williams [Wed, 14 Oct 2009 00:41:53 +0000 (17:41 -0700)] 
imsm: regression test for prodigal array member scenario

Provide a test to sanity check assembly and reassembly in the presence
of conflicting family number information.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: add --update=uuid support
Dan Williams [Wed, 14 Oct 2009 00:41:53 +0000 (17:41 -0700)] 
imsm: add --update=uuid support

When disks have conflicting container memberships (same container ids
but incompatible member arrays) --update=uuid can be used to move
offenders to a new container id by changing 'orig_family_num'.

Note that this only supports random updates of the uuid as the actual
uuid is synthesized.  We also need to communicate the new
'orig_family_num' value to all disks involved in the update.  A new
field 'update_private' is added to struct mdinfo to allow this
information to be transmitted.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoddf: prevent superblock being zeroed on --update
Dan Williams [Wed, 14 Oct 2009 00:41:53 +0000 (17:41 -0700)] 
ddf: prevent superblock being zeroed on --update

The full fix would be to support updating ddf metadata, but this minimal
fix just prevents the superblock from being zeroed when someone
inadvertently passes an unsupported --update option during assembly.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix/support --update
Dan Williams [Wed, 14 Oct 2009 00:41:53 +0000 (17:41 -0700)] 
imsm: fix/support --update

Fix init_super_imsm() to return an empty mpb when info == NULL, and
teach store_super_imsm() to simply write out the passed in mpb.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=523320
Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix spare record writeout race
Dan Williams [Wed, 14 Oct 2009 00:41:53 +0000 (17:41 -0700)] 
imsm: fix spare record writeout race

imsm_activate_spare() in the manager thread may race against
write_super_imsm_spares() in the monitor thread.  Give
write_super_imsm_spares() its own private mpb buffer to prevent
confusing the manager.

This change uncovered cases where spares were not being assembled due to
a failed metadata version number check.  Spares can freely associate
across metadata version number, so reduce the scope of the version check
in the spare assembly case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agorestripe: fix compile warning.
NeilBrown [Mon, 12 Oct 2009 06:00:23 +0000 (17:00 +1100)] 
restripe: fix compile warning.

Just a type cast...

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotest changelevel: add tests for changing degraded arrays.
NeilBrown [Mon, 12 Oct 2009 05:57:55 +0000 (16:57 +1100)] 
test changelevel: add tests for changing degraded arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agorestripe : various fixed for RAID6 2-failure recovery.
NeilBrown [Mon, 12 Oct 2009 05:57:22 +0000 (16:57 +1100)] 
restripe : various fixed for RAID6 2-failure recovery.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoTest level changes and related reshaping.
NeilBrown [Mon, 12 Oct 2009 05:57:18 +0000 (16:57 +1100)] 
Test level changes and related reshaping.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: ignore error from final wait_backup
NeilBrown [Mon, 12 Oct 2009 05:55:19 +0000 (16:55 +1100)] 
Grow: ignore error from final wait_backup

The last time wait_backup is called, it might see reshape
finish and so return an error indicator.
But this is not an error, and we must go ahead and prepare
the array for full access.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: make sure bsb2 is properly aligned
NeilBrown [Mon, 12 Oct 2009 05:55:12 +0000 (16:55 +1100)] 
Grow: make sure bsb2 is properly aligned

We do O_DIRECT io in bsb2, so it must be aligned
properly.  Easiest if it is static.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotestreshape5 - add tests for RAID6
NeilBrown [Mon, 12 Oct 2009 05:55:05 +0000 (16:55 +1100)] 
testreshape5 - add tests for RAID6

.. to make sure our raid6 calculations are working.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' into devel-3.1
NeilBrown [Thu, 1 Oct 2009 06:58:40 +0000 (16:58 +1000)] 
Merge branch 'master' into devel-3.1

Conflicts:
mdadm.8

14 years agoFix null-dereference in set_member_info
NeilBrown [Thu, 1 Oct 2009 02:51:04 +0000 (12:51 +1000)] 
Fix null-dereference in set_member_info

set_member_info would try to dereference ->metadata_version, without
checking that it isn't NULL.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAdd missing space in "--detail --brief" output.
NeilBrown [Thu, 1 Oct 2009 02:38:31 +0000 (12:38 +1000)] 
Add missing space in "--detail --brief" output.

We need a space between the device name and the word "level"..

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: disambiguate family_num
Dan Williams [Wed, 30 Sep 2009 18:45:41 +0000 (11:45 -0700)] 
imsm: disambiguate family_num

This is a result of trawling through the Windows implementation to learn
the mechanism of how it disambiguates family_num.  It is a continuation
of commit 148acb7b "imsm: fix family number handling" which introduced a
regression when reassembling a container with stale disks and rebuilt
members.

When rebuilding, a new family number is assigned to protect against the
"prodigal array member" problem.  It prevents a former family member
from returning to the system and causing a rebuild to go the wrong
direction.  However, this invalidates looking at the generation number to
determine the most up-to-date disk when comparing across family numbers.
Instead the assembly logic looks for agreement between a disk's local
family membership compared against a global list of all families in the
system.  Whenever a disk's local metadata does not match a family number
on the global list that family number is marked offline.

It is possible that this logic results in multiple incompatible but
valid family numbers existing in a container.  In this case mdadm.conf
cannot be consulted because it only records the uuid which is generated
from static fields in the metadata.  The metadata lacks the data needed
to disambiguate "local" versus "foreign".  The "foreign" array in this
case requires updating to change its container-id information
(orig_family_num), and possibly the member array names.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: kill close() of component device
Dan Williams [Wed, 30 Sep 2009 18:44:38 +0000 (11:44 -0700)] 
imsm: kill close() of component device

None of the other formats close the passed in fd at load, and this
becomes a problem when trying to support --update where we need O_EXCL
protection across the entire operation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: cleanup disk status tests
Dan Williams [Mon, 28 Sep 2009 21:40:59 +0000 (14:40 -0700)] 
imsm: cleanup disk status tests

Add is_failed(), is_configured(), and is_spare() helpers to clean up
disk status flag testing.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoRelease mdadm-3.0.2 mdadm-3.0.2
NeilBrown [Fri, 25 Sep 2009 08:19:07 +0000 (18:19 +1000)] 
Release mdadm-3.0.2
Just one bugfix.

14 years agosuper0: fix crash on assemble if homehost is not set.
NeilBrown [Fri, 25 Sep 2009 07:56:22 +0000 (17:56 +1000)] 
super0: fix crash on assemble if homehost is not set.

If homehost is not set - typically during early boot,
and assemble of v0.90 metadata arrays will crash.

Reported-by: Paweł Sikora <pluto@agmk.net>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix raid6 error recovery in 'restripe' code.
NeilBrown [Fri, 25 Sep 2009 07:23:33 +0000 (17:23 +1000)] 
Fix raid6 error recovery in 'restripe' code.

Thanks to Matthias Urlichs for discovering and reporting this.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRelease mdadm-3.0.1 mdadm-3.0.1
NeilBrown [Fri, 25 Sep 2009 07:08:19 +0000 (17:08 +1000)] 
Release mdadm-3.0.1

Just bugfixes.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agotestreshape5 - flush devices between tests.
NeilBrown [Fri, 25 Sep 2009 06:57:01 +0000 (16:57 +1000)] 
testreshape5 - flush devices between tests.

We need to flush the block devices before reading different data.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' of git://github.com/djbw/mdadm
NeilBrown [Fri, 25 Sep 2009 04:11:11 +0000 (14:11 +1000)] 
Merge branch 'master' of git://github.com/djbw/mdadm

14 years agomdmon: fix freeing unallocated memory
Hans de Goede [Thu, 24 Sep 2009 13:52:06 +0000 (06:52 -0700)] 
mdmon: fix freeing unallocated memory

mdmon was creating a supertype struct with malloc, and thus not
necessarily getting zero-d memory.

This was causing it to segfault when called like this from the initrd:
/sbin/mdmon /proc/mdstat /sysroot

The problem was that  load_super_imsm would get called on the non-zero'd
super struct, whcih in turn calls free_super_imsm, which checks st->sb,
which should be zero but isn't and then starts freeing bogus memory.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: clear CONFIGURED_DISK for failed drives
Dan Williams [Tue, 15 Sep 2009 18:35:28 +0000 (11:35 -0700)] 
imsm: clear CONFIGURED_DISK for failed drives

Synchronizing with what the Windows driver does.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: kill USABLE_DISK flag
Dan Williams [Tue, 15 Sep 2009 18:35:28 +0000 (11:35 -0700)] 
imsm: kill USABLE_DISK flag

'USABLE_DISK' is not a 'persistent' status flag it is an internal status
flag used for the in memory representation of the disk in the Windows
driver.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoExamine: don't count containers as spares
Dan Williams [Tue, 15 Sep 2009 18:35:28 +0000 (11:35 -0700)] 
Examine: don't count containers as spares

mdadm -Ebs will include containers in the scanned device list.
Examine() falsely thinks they are spares when MD_DISK_SYNC is not set.
This could be fixed by forcing all formats to set this flag for
container devices, but this flag is currently used by imsm to identify
free-floating spares.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoDetail: fix for an imsm container with a spare
Dan Williams [Tue, 15 Sep 2009 18:34:20 +0000 (11:34 -0700)] 
Detail: fix for an imsm container with a spare

Spares for imsm arrays do not have any info about the container in their
metadata records.  If Detail() inadvertantly picks such a device for
->get_array_info() it will end up with less than useful info for the
container.  So, continue to read from the disks until a non-spare device
is found.

This bug was found by timeouts waiting for udev to create the
user-friendly container name.  To detect future UUID reporting problems
and a debug print to the timeout case in wait_for().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoExamine: fixup output in the presence of containers with spares
Dan Williams [Tue, 15 Sep 2009 18:34:20 +0000 (11:34 -0700)] 
Examine: fixup output in the presence of containers with spares

If we dump any 'spare' or 'device' information for a container in the
'brief' case then we need a newline before printing member array info.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix spare promotion
Dan Williams [Tue, 15 Sep 2009 18:34:20 +0000 (11:34 -0700)] 
imsm: fix spare promotion

1/ Fix an off by one error when detecting whether the device allocation
   loop succeeded or not
2/ Update ->num_raid_devs before copying to avoid a segmentation fault

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoAdd a missing 'closedir'.
NeilBrown [Fri, 11 Sep 2009 06:10:24 +0000 (16:10 +1000)] 
Add a missing 'closedir'.

Thanks to David Binderman for finding and reporting it.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agosuper1: remove fd leak when opening /dev/urandom
NeilBrown [Thu, 13 Aug 2009 05:02:39 +0000 (15:02 +1000)] 
super1: remove fd leak when opening /dev/urandom

As reported in
   https://bugzilla.novell.com/show_bug.cgi?id=527722

I forgot to close the fd after reading the random number.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdadm.8 : update documentation for new --grow modes
NeilBrown [Thu, 13 Aug 2009 01:41:40 +0000 (11:41 +1000)] 
mdadm.8 : update documentation for new --grow modes

14 years agoGrow: support restart of new migrations.
NeilBrown [Thu, 13 Aug 2009 01:12:54 +0000 (11:12 +1000)] 
Grow: support restart of new migrations.

14 years agoHandle extra 'grow' variations.
NeilBrown [Tue, 11 Aug 2009 03:02:49 +0000 (13:02 +1000)] 
Handle extra 'grow' variations.

UNFINISHED

14 years agoExmaine/brief: put member arrays after container arrays.
NeilBrown [Fri, 7 Aug 2009 04:17:40 +0000 (14:17 +1000)] 
Exmaine/brief: put member arrays after container arrays.

A previous patch moved move the '--examine --brief' reporting of
member arrays to before their containers.  This breaks "mdadm -As"
assembly.  So put them back, but still fix the problem addressed by
previous patch.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' of git://github.com/djbw/mdadm
NeilBrown [Fri, 7 Aug 2009 03:45:38 +0000 (13:45 +1000)] 
Merge branch 'master' of git://github.com/djbw/mdadm

14 years agoAssemble: fix handling of empty container
Dan Williams [Tue, 4 Aug 2009 17:17:23 +0000 (10:17 -0700)] 
Assemble: fix handling of empty container

# mdadm --create /dev/md/ddf /dev/sd[b-e] -n 4 -e ddf
mdadm: container /dev/md/ddf prepared.
# mdadm -Ss
mdadm: stopped /dev/md126
# mdadm -As
mdadm: Container /dev/md/ddf0 has been assembled with 4 drives
Segmentation fault

Reported-by: Artur Wojcik <artur.wojcik@intel.com>
Reported-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix spare-uuid assignment
Dan Williams [Sat, 1 Aug 2009 00:11:42 +0000 (17:11 -0700)] 
imsm: fix spare-uuid assignment

imsm spares do not have container membership by default so we associate
them with the first container found in the configuration file.  Some
ARRAY lines do not specify the metadata type so we cannot assume that
_cst will always be valid.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoplatform: relax rom scanning alignment for ahci platforms
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
platform: relax rom scanning alignment for ahci platforms

The PCI-3.0 Firmware specification allows for option-roms to have
512-byte alignment rather than 2048-byte.  As there does not appear to
be a reliable method to detect a PCI-3.0 compliant BIOS from userspace
we allow the imsm platform detection code to presume that a system
modern enough to have an Intel AHCI controller does not have
dangerous/legacy ISA regions in the option-ROM memory space.

An environment variable to disable this behaviour, IMSM_SAFE_OROM_SCAN,
is added in case this presumption is ever proven wrong.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix family number handling
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
imsm: fix family number handling

The family_number field can change.  The option-rom will change the
family number when it starts a rebuild process (flags a container for
rebuild).  This was not seen previously as mdadm would usually start the
rebuild process, preserving the family number.

This is the mechanism that helps to prevent a prodigal array member from
being returned to its original system and cause a rebuild to go in the
wrong direction.  With the change we will end up with a container that
will fail to assemble unless the device with the incompatible family
number is left out of the assembly.

So, take several actions:
1/ Convert uuid generation to use orig_family_num, being careful to
   preserve the existing uuid in the case where orig_family_num is not
   set (i.e. previous mdadm created imsm arrays)
2/ Set orig_family_num at Create.  For arrays created by mdadm prior to
   this release orig_family_num will be zero, so set it to family_num at
   the first metadata write.
3/ Add checks for orig_family_num to compare_super_imsm
4/ Update the family number when initiating rebuild
5/ The option-rom mixes some random data into the family number, add
   this functionality to the mdadm implementation.

Reported-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fix activate_spare off-by-one
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
imsm: fix activate_spare off-by-one

The last sector of an array is calculated by start + size - 1.

Reported-by: Rafal Marszewski <rafal.marszewski@intel.com>
Reported-by: Jarema Bielanski <jarema.bielanski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoconditionally update uuids in the map file after Create()
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
conditionally update uuids in the map file after Create()

The map file needs to be updated after adding the first member array to
an Intel metadata container.  The uuid for an imsm container uses the
->family_num field of the metadata.  This field is static, but is only
set after the first member array has been created.  Prior to this all
devices are free floating spares and do not have any information that
can identify specific container membership.  At Create() time we take
the uninitialized uuid from ->get_info_super() prior to updating the
metadata.  So the current result is:

# mdadm --create /dev/md/imsm /dev/sd[b-e] -n 4 -e imsm
# mdadm --create /dev/md/vol0 /dev/md/imsm -n 4 -l 0
# cat /var/run/mdadm/map
md126 /md127/0 3e03aee2:78c3c593:1e8ecaf0:eefb53ed /dev/md/vol0
md127 imsm 53d6f8b1:7a783f24:f30483c5:705c48c7 /dev/md/imsm
# mdadm -Ebs
ARRAY metadata=imsm UUID=589d2d2c:4221a54d:acb63c06:c3907f52
ARRAY /dev/md/vol0 container=589d2d2c:4221a54d:acb63c06:c3907f52
member=0 UUID=57b89b63:5cd0eae1:17dd26b3:51cc78d4

So, before we write out the new metadata check to see if the member
array uuid has changed as a result of this addition.  If it has, update
its uuid in the map file and flag its parent container for updating.  In
support of updating the container uuid the semantics of
->write_init_super are changed to clear any metadata specific member
array cursors (e.g. ddf_super.currentconf or intel_super.current_vol)
such that a subsequent call to ->getinfo_super returns container
information.

Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoimsm: fixup examine_brief to be more descriptive in the container only case
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
imsm: fixup examine_brief to be more descriptive in the container only case

Prior to creating any arrays in a new container the output from -Ebs for
a 4-disk imsm array returns:

spares=4

We should at least display that these are imsm spares:

ARRAY metadata=imsm
spares=4

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agofix examine_brief segfault
Dan Williams [Sat, 1 Aug 2009 00:11:41 +0000 (17:11 -0700)] 
fix examine_brief segfault

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

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

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

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

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

...to:

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

Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agoteach imsm and ddf what st->subarray means at load_super time
Dan Williams [Sat, 1 Aug 2009 00:08:22 +0000 (17:08 -0700)] 
teach imsm and ddf what st->subarray means at load_super time

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

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
14 years agorestripe: support saving when not all devices are present.
NeilBrown [Tue, 14 Jul 2009 05:12:30 +0000 (15:12 +1000)] 
restripe: support saving when not all devices are present.

14 years agoExamine/Detail: report raid6 layout
NeilBrown [Tue, 14 Jul 2009 05:12:29 +0000 (15:12 +1000)] 
Examine/Detail:  report raid6 layout

Somehow this was missing before...

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: --size improvements.
NeilBrown [Tue, 14 Jul 2009 04:32:30 +0000 (14:32 +1000)] 
Grow:  --size improvements.

1/ allow --size to be given with 'G' or 'T' suffix.
2/ allow size to exceed 32bits, and in that case write through sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: pass layout as a string rather than a number.
NeilBrown [Tue, 14 Jul 2009 02:13:29 +0000 (12:13 +1000)] 
Grow: pass layout as a string rather than a number.

This allows the layout to be parsed after the current level of the
array is know, so that the level doesn't need to be given (otherwise
pointlessly) on the command line.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRemove Manage_reconfing in favour of Grow_reshape
NeilBrown [Tue, 14 Jul 2009 02:11:31 +0000 (12:11 +1000)] 
Remove Manage_reconfing in favour of Grow_reshape

Bother Manage_reconfig and Grow_reshape provide for changing
the 'layout' of a faulty array.  This is no necessary.
So discard Manage_reconfig and just use Grow_reshape

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomain: factor out code to parse layout for raid10 and faulty.
NeilBrown [Tue, 14 Jul 2009 01:29:20 +0000 (11:29 +1000)] 
main: factor out code to parse layout for raid10 and faulty.

This will soon be called from multiple places.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: support --array-size changes
NeilBrown [Mon, 13 Jul 2009 05:00:02 +0000 (15:00 +1000)] 
Grow:  support --array-size changes

With 2.6.30 it is possible to tell the md driver to clip an array to a
size smaller than the real size of the array.  This option gives
access to that feature.  The size change does not persist
across restarts.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMonitor: use pclose rather than fclose
NeilBrown [Fri, 10 Jul 2009 04:39:20 +0000 (14:39 +1000)] 
Monitor: use pclose rather than fclose

Using pclose is probably the right thing to do seeing that we
used popen, but as there is no clear need to wait for sendmail
to finish, it isn't really important.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoExamine: make --metadata= work with --brief
NeilBrown [Fri, 10 Jul 2009 00:44:32 +0000 (10:44 +1000)] 
Examine: make --metadata= work with --brief

They had different assumptions about the lifetime of 'st'.

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

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

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

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

Reported-By: "Mr. James W. Laferriere" <babydr@baby-dragons.com>
Signed-off-by: NeilBrown <neilb@suse.de>