Michael Evan [Thu, 10 Dec 2009 05:52:18 +0000 (21:52 -0800)]
Document validity of --assume-clean when all devices are zeroed.
>>
>> When I assemble an array I tend to have checked the devices before
>> hand; it would not be difficult to make the final pass a zeroing pass
>> if I knew I could vastly speed up post-assembly performance. As I
>> stated, it's merely a lack of clarity in the documentation.
>
> If you would like to create a patch against the man page, I would be happy to
> accept it.
>
> NeilBrown
Dan Williams [Tue, 22 Dec 2009 00:54:32 +0000 (17:54 -0700)]
imsm: add support for checkpointing via 'curr_migr_unit'
Unlike native md checkpointing some data about the geometry and type of
the migration process is coded into curr_migr_unit. Provide logic to
convert between md/{resync_start|recovery_start} and imsm/curr_migr_unit.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Mon, 21 Dec 2009 19:51:57 +0000 (12:51 -0700)]
Support external metadata recovery-resume
Minimal changes needed to permit reassembling partially recovered
external metadata arrays. The biggest logical change is that
->container_content() can now surface partially rebuilt members rather
than omitting them from the disk list.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Mon, 14 Dec 2009 19:57:55 +0000 (12:57 -0700)]
mdmon: cleanup resync_start
We don't need to sprinkle reads of this attribute all over the place,
just once at the entry of read_and_act(). Also, the mdinfo structure
for the array already has a 'resync_start' member, so just reuse that.
Finally, rename get_resync_start() to read_resync_start to make it
consistent with the other sysfs accessors in monitor.c.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Sat, 12 Dec 2009 20:57:25 +0000 (13:57 -0700)]
imsm: fix thunderdome segfault
disk_list_get() can return NULL if:
1/ A formerly missing disk is re-added
2/ The original array has not been rebuilt, so the family number of the
missing disk still matches
3/ The metadata record of the in-sync disks are read before the missing
disk
This will result in the missing disk not adding its own serial number to
the disk_list, only its truncated value will be present.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Dan Williams [Thu, 10 Dec 2009 22:03:31 +0000 (15:03 -0700)]
imsm: honor orom constraints for auto-layout
Factor out the orom checking bits to validate_geometry_imsm_orom() and
share it between validate_geometry_imsm_volume() and the entry path to
reserve_space().
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Artur Wojcik [Thu, 10 Dec 2009 19:03:40 +0000 (12:03 -0700)]
Fix required to enable RAID arrays on SAS disks.
The patch increases the capacity of buffers used to store
sysfs path names. Originally the buffers were too small to
hold the canonical representation of sysfs path (in case
of a SAS device, especially a device installed behind an
expander).
Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Reviewed-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Artur Wojcik [Thu, 10 Dec 2009 19:03:39 +0000 (12:03 -0700)]
Fix for NULL pointer dereference.
Pointers '_dev' and '_disk' returned from call to function '_get_imsm_dev'
and '_get_imsm_disk' may be NULL and will be dereferenced at lines
2933 and 2934, respectively.
Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
NeilBrown [Tue, 8 Dec 2009 06:26:31 +0000 (17:26 +1100)]
Don't attempt a re-add if the device is marked as faulty.
If a device is marked as faulty, then a re-add will cause it to be
added as a faulty drive, which is not what it wanted.
So just refuse to try to re-add a device which is marked 'faulty'.
Trela, Maciej [Tue, 8 Dec 2009 05:07:47 +0000 (16:07 +1100)]
Check partition tables when creating array.
When creating an array, check if the devices have partition
tables and print a warning if the table or the partitions might be
destroyed by array creation.
Dan Williams [Tue, 1 Dec 2009 23:04:06 +0000 (16:04 -0700)]
imsm: catch attempt to auto-layout zero-length arrays
When -z is omitted reserve_space() looks to satisfy a zero length
allocation which lo and behold is equal to the amount of free space on a
full disk. So, catch maxsize == 0 and simplify the return value from
merge_extents() to always equal amount of free space (no benefit to
having a special case ~0ULL == error).
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
NeilBrown [Thu, 26 Nov 2009 03:19:26 +0000 (14:19 +1100)]
Grow: avoid truncation error when checking size of array.
array.size is only 32bit so it is not safe to multiply it
up before casting to (long long).
Actually, we shouldn't be using array.size here at all, but that
will get fixed in a subsequent patch.
Reported-by: Andrew Burgess <aab@cichlid.com> Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Tue, 24 Nov 2009 05:32:01 +0000 (16:32 +1100)]
Various fixes for --kill
- When --kill-superblock is used with --metadata, find every
different superblock if there are several and kill them all.
- When creating a new array, kill off any old metadata. The code
to do this was already present but has become broken over time.
NeilBrown [Thu, 19 Nov 2009 04:54:49 +0000 (15:54 +1100)]
Create: warn when creating a raid1 using default metadata.
As a some/most bootloaders don't understand md metadata, it might
be difficult to boot off an array with the default 1.0 metadata.
So if this is used for a RAID1, ask for confirmation.
NeilBrown [Tue, 17 Nov 2009 02:15:34 +0000 (13:15 +1100)]
Don't silently map --re-add to --add
As --add can destroy important data on a disk, and
--re-add is not suppose to, it is wrong to silently
try --add if --re-add fails.
So print a message and abort instead.
NeilBrown [Tue, 17 Nov 2009 02:15:34 +0000 (13:15 +1100)]
Improve error messages when metadata handler does not support request.
->validate_geometry is called to validate overall parameters,
and to validate each individual device.
If it ever fails, it needs to report the reason, as common code
cannot possible know.
NeilBrown [Tue, 17 Nov 2009 02:15:32 +0000 (13:15 +1100)]
Change default metadata from 0.90 to 1.1
1.1 is more flexible in a number of ways and is safer.
0.90 is still fully supported.
1.0 should possibly be used for RAID1 arrays that you
want to boot off, depending on your boot loader.
NeilBrown [Tue, 17 Nov 2009 02:08:55 +0000 (13:08 +1100)]
Increase default chunk size to 512K
This seems more appropriate for current (and recent) model drives than
64K.
64K is still the default for '--build' as changing that could corrupt
data.
64K is also the default rounding for 'linear' on kernels older than
2.6.16.
NeilBrown [Tue, 17 Nov 2009 01:31:10 +0000 (12:31 +1100)]
Assemble/super0: allow non-in-sync devices to be assembled without complaint.
Other metadata formats already did not worry about whether 'sync' was
missing or not. super0 needs that now, but only for 0.91 metadata
that is undergoing reshape.
NeilBrown [Tue, 17 Nov 2009 01:30:54 +0000 (12:30 +1100)]
Assemble: include ACTIVE but not in-sync devices as non-spares.
Previously such things did not exist: ACTIVE and SYNC were either both
set or both clear. Recent changes with reshape means that a device
can be ACTIVE but not yet fully in-sync, so they need to be handled
and included in the array as active devices.
NeilBrown [Fri, 6 Nov 2009 06:26:47 +0000 (17:26 +1100)]
Grow: do not allow size changes with other changes.
A change the reduces the size of an array always happens
before any other change. So it can cause data to be lost.
By themselves these changes are reversible. But once another
change has started, the data would be permanently lost.
So recommend data integrity be checked between a size change
and any other change.
NeilBrown [Fri, 6 Nov 2009 04:19:39 +0000 (15:19 +1100)]
Grow: restrict to 2.6.32
2.6.31 has a bug which can lead to unsafe reshaping.
So only allow a reshape with 2.6.32.
When the required fixed get into 2.6.31.y, this can be relaxed
slightly
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.
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>
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'
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.
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>
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>
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>