Commit Graph

2921 Commits

Author SHA1 Message Date
NeilBrown 9275a5ec59 Release mdadm-3.3.1
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 16:54:24 +10:00
NeilBrown 1e60caebbc Make sure "make everything" builds again.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 16:38:29 +10:00
NeilBrown 02b70e83e6 Incremental: remove old devices when assembling in container.
When assembling a native array we just give all devices to the kernel
and leave it to discard the 'old' ones (based on sequence/event
number).

For external/container arrays, mdadm needs to do that.

So in assemble_container_content, get list of current devices in
array and discard any that aren't in the 'content' given.
They must have been rejected by metadata manager.

If we cannot discard old devices the array must already be active, so
just leave it alone, but with a message.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 15:58:31 +10:00
Artur Paszkiewicz 8a3544f895 imsm: retry load_and_parse_mpb if we suspect mdmon has made modifications
If the checksum verification fails in mdadm and mdmon is running, retry
the load to get a consistent snapshot of the mpb.

Based on db575f3b

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-03 09:09:41 +10:00
Baldysiak, Pawel 40b941b813 Grow: Do not fork via systemd if freeze_reshape is set
Mdadm should not run 'grow-continue' unit file for container if
'--freeze-reshape' argument is passed. Otherwise it will be ignored,
and reshape will start anyway.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-02 12:42:01 +10:00
Baldysiak, Pawel 054cba7719 Grow: Use 'forked' also for reshape_container in Grow_continue
Similar to commit 06e293d097
same thing should be done for reshape_container in Grow_continue

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-02 12:39:14 +10:00
Baldysiak, Pawel 18d9bcfa33 Do not set default 'before.layout' when reshaping from RAID4 to RAID4
Commit fdcad551e9
brings some changes to reshape process.
Setting 'before.layout' when reshaping from RAID4 to another RAID4 is
not really necessary.
If reshape is restarted 'before.layout' will be compared with
'info->array.layout' in reshape_array(). Changes brought by mentioned
commit will cause this comparation return as false, becouse 'array.layout'
is always set to 'ALGORITHM_PARITY_N' in analyse_change() for RAID4, so
reshape will not be continued after reboot/stop.
This patch reverts unnecessary changes.

Signed-off-by: Pawel Baldysiak pawel.baldysiak@intel.com
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-02 12:29:37 +10:00
NeilBrown 868ab80dea mdcheck: don't pass the '+' to "date".
It isn't needed, makes is harder to describe what --duration does.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-26 09:37:05 +10:00
NeilBrown 20d430ca81 DDF: remove "BVD xx is missing".
This can happen in normal cases during incremental assembly so
printing an error message is confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 17:22:47 +10:00
NeilBrown 85945e1986 install: use BINDIR consistently to locate mdadm and mdmon
Every place where the paths for mdadm or mdmon is explicit,
it should use the BINDIR setting, not "/sbin/".

Reported-by: member graysky <graysky@archlinux.us> (https://bugs.archlinux.org/task/37330)
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 17:13:02 +10:00
NeilBrown df881f757b mdcheck: new script to help with regular checks of md arrays.
This script allows arrays to be 'checked' for a limited amount
of time on a regular basis.

For example, running

 mdcheck --duration 6hours

early every Sunday morning and

 mdcheck --continue 6hours

ever other morning will check all arrays every week, but if that take
more than 6 hours, will won't run into the day, but will be continued
the next morning, and the next ... etc.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 16:00:39 +10:00
NeilBrown a740cf6432 MISC: add --action option to set or abort check/repair.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 15:55:31 +10:00
NeilBrown 1e781e07ab --examine-bitmap: give useful message if no bitmap found on md array.
The bitmap is stored on member devices, not on the array, so
--examine-bitmap should be given the member device.
If --examine-bitmap is given an array, and it doesn't have a bitmap
on it (i.e. it isn't a member of some other array), then that
is probably a usage error, so print a helpful message.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 15:22:39 +10:00
Cristian Rodríguez 04f903b21a mdadm: Do not reimplment offsetof
Proper implementations have offsetof in stddef.h

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 14:29:14 +10:00
NeilBrown 06e293d097 Grow: fix resent grow_continue breakage.
Commit 5e76dce1ac changed
Grow_continue to assume a fork had already happened, so that
   mdadm --grow --continue

didn't fork.  This is good, but it means that if Grow_continue
is run from Assemble, then
  mdadm --assemble ....

can misbehave if the array was in the middle of a reshape.

So introduce finer control.  Grow_continue only assumes it has
already forked if run from "mdadm --grow --continue".

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 14:22:58 +10:00
NeilBrown 2ecda5a3fa DDF: remove some pointless code in validate_geometry
I'm not sure what this was supposed to do, but it isn't needed
as creating on a container and on individual devices (in a container)
work fine already.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 14:03:48 +10:00
NeilBrown 3d99ecd7b5 DDF: remove a FIXME comment that doesn't seem to mean anything.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:51:33 +10:00
NeilBrown 98fbc0ff37 DDF: remove 'FIXME' comment that doesn't need fixing.
It appears this is correct, though for consistency with elsewhere
we check that pdnum is not negative.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:50:52 +10:00
NeilBrown de9107744b DDF: ensure dl->devname is freed when processing a 'delete device' update.
As this code runs in 'monitor' it cannot just free memory,
it must add it to a list for 'manager' to free.
Fortunate update->space_list exists for just this purpose.
dl->devname might be small, so put it in update->space and
put dl in update->space_list.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:27:54 +10:00
NeilBrown 30da0fa89b DDF: remove old comment about looking for spares.
As handle_missing() sets ->check_degraded, nothing else needs to be
done here.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:10:03 +10:00
NeilBrown 733eedc8f2 DDF: remove an old incorrect FIXME comment.
We mustn't close fds in write_init_super if ->update_tail
was set.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:00:08 +10:00
NeilBrown 31bc5466f5 DDF: add data-offset information to --examine output.
Raid Devices[1] : 5 (4@20000K 3@20000K 2@0K 1@0K 0@0K)

The data offsets are 200000K and 0K.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 12:43:40 +10:00
NeilBrown fea6a6c0bf DDF: split up ddf_process_update
Function was way too big, make several smaller functions.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 12:20:56 +10:00
NeilBrown a34c8836f0 tests: handle change to DDF assembly.
When a DDF array is assembled with missing devices, those devices
are now alway marked as 'missing' and cannot just re-appear in the array
and be working again.

test must be changed to acknowledge this.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 1c2cdb9072 tests: handle new raid10/ddf geometries.
Recent changes to support more ddf geometries using raid1e
requires updates to tests.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 476066a3d5 DDF: add support of --data-offset when creating array.
Infrastructure is there, so use it.

This requires making sure that ->data_offset is correctly set, even
for containers.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown fca6552000 DDF: factor out common code for search through extents.
Each place the uses "get_extents" has slightly different search code
to look through the result.

Factor this out into a single find_space() function.

This is will make it easier to add --data-offset support.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 708997ffb7 DDF: allow for unused slots when creating map list for getinfo_super_ddf.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 4fe903aa8b DDF: DDF_Missing devices should not be reported as 'working' by getinfo_super_ddf
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 25532b88a0 DDF: remove old and wrong comment about settinig raid_disk.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown ff84d05210 DDF: provide simple detail_super() implementation.
Just print the GUID, Seq and number of VDs in the container.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown f70d549f12 DDF: support more RAID10 levels.
The DDF "RAID1E" level is similar to md "raid10".

So use raid10 to support RAID1E, and create RAID1E for raid10
configs not already supported.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 2770f45a43 DDF: explain why spare_refs are ignored.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 55e0007423 DDF: use array_size from metadata.
If some other controller sets a number smaller than a calculation
would give us, we really should honour it.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 2a351cea60 DDF: set utime for container from timestamp is superblock.
Also be more consistent about setting events from seq in superblock.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 30bee02013 DDF: don't assume the anchor is fully up-to-date.
We currently copy the anchor to both primary and secondary
blocks.
This assumes that the anchor is uptodate, but it might not be.
We should trust the 'active' block and copy from there.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 609ce16109 DDF: update timestamp/seqnum for virtual disks when config changes.
- we weren't updating this timestamp at all
- the 'vd_config' seqnum was updated on every write of the metadata,
  which is excessive.  Just update it when there is a change.


Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 07de268426 DDF: update timestamp in DDF header.
Doco says:
  Header update timestamp. MUST be set when the DDF
  header is updated.

So I guess we should.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 0d255ff84e DDF: avoid ref outside array in getinfo_super_ddf_bvd
As we are range-checking 'cd', there is a chance that it is not
in-range.  In that case we should include all array indexes with 'cd'
inside the range-tested branch.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:47 +10:00
NeilBrown d2ec75fb3e DDF: examine_pds to also list devices that aren't in the metadata.
The phys disks table should list all disks, but if the metadata
is corrupt, it might not even list the disk it was read from.
So check for and report any known disks that aren't listed.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:47 +10:00
NeilBrown 217dead48f DDF: fix usage of ->used_pdes
The "used_pdes" value counts the number of physdisk entries that
are in used.
It may not be the last one in use as there may be unused slots in
the middle.

So when were are iterating over phys disks, we need to use max_pdes
and skip unused entries.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:47 +10:00
NeilBrown 41bcbc14c4 DDF: more guards against pdnum being negative.
With consistent metdata, pdnum should never be negative,
but it is better to be safe than sorry.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:47 +10:00
NeilBrown 4e0eb0dbbd Reshape: use systemd to continue containers as well as native arrays.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-20 17:00:27 +10:00
NeilBrown b0b67933dc Grow: split continue_via_systemd into a separate function.
This allows it to be used for containers too.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-20 16:56:51 +10:00
NeilBrown b0140ae83c Grow: add 'forked' option to reshape_container.
This is a better match for reshape_array() and means that
"mdadm --grow --continue" will run in the foreground, which
makes more sense.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-20 16:51:56 +10:00
NeilBrown 5e76dce1ac Grow: try to let "--grow --continue" from systemd complete a reshape.
If "--assemble" or "--incremental" is started by udev, then
monitoring the reshape in the background won't work.

So try asking systemd to start a grow-continue.

If that fails, just do it the old way.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-15 14:23:21 +10:00
NeilBrown 54ded86fbd Grow: store a link to current backup file in /run/mdadm or similar.
Subsequent patch will allow the background part of "mdadm --grow" to
be run from systemd.  This can require the passing of a backup file
name.
To do this, store that name as a symlink in /run/mdadm (or MAP_DIR)
and look for it when appropriate.

It might be useful to also store the name across reboot, but that
would be a different patch.  We would need to use the uuid to identify
it, and store it in stable storage.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-15 14:23:16 +10:00
Artur Paszkiewicz 39917e56cc Create: don't default to bitmap=internal when it is not supported
For large arrays (component size > 100GB) if write-intent bitmap is not
enabled, then it is set by default to "internal", even if the metadata
format does support internal bitmaps, which causes Create to fail.

This patch adds checking if add_internal_bitmap is set in the
superswitch before setting bitmap_file to "internal".

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-01 10:14:59 +10:00
Artur Paszkiewicz 19ad4b2cb2 Fix race between --create and --incremental
This modifies locking in Create to eliminate a situation where
--incremental can assemble a device between write_init_super() and
add_disk(), which causes Create to fail.

It sporadically occurs e.g. when metadata is written on a device,
causing an udev change event which triggers mdadm --incremental.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-01 10:14:53 +10:00
NeilBrown 8d1d32bb33 systemd: various fixes for boot with container-arrays.
1/ Add systemd shutdown script to ensure DDF and IMSM are
   clean before we actually shutdown

2/ Get udev to tell systemd to run the mdmon@mdXXX.service
   units when a member array appears.

   If we boot off a member array (with dracut at least),
   the mdmon started in the initramfs will lose track of
   /sys etc, so we need to restart it.
   systemd will try to forget about it too (but not actually
   kill it because we said not to do this).
   Having udev tell it to start it will allow a new mdmon to
   run which can see /sys, and systemd will know about it.

3/ Always use --offroot and --takeover when starting mdmon with
   systemd
   --offroot is needed else shutdown will hang.
   --takeover is needed incase an mdmon was started earlier
   (e.g. in initramfs).
   Neither hurt if they aren't actually needed.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-04-08 17:37:08 +10:00