Commit Graph

275 Commits

Author SHA1 Message Date
NeilBrown a34fea0eae DDF - really ignore DDF metadata on partitions.
See commit 357ac10678
which made a similar change for super-intel, and really should have
fixed DDF at the same time.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-01-20 12:25:23 +11:00
mwilck@arcor.de 105e6e93a2 DDF: add_to_super_ddf: be careful with workspace_lba
Some vendor DDF structures interpret workspace_lba
very differently then us. Make a sanity check on the value
before using it for config_size.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-10-16 15:31:30 +11:00
mwilck@arcor.de 7039479987 DDF: compare_super_ddf: fix sequence number check
The sequence number check in compare_super_ddf was broken,
anchor sequence number is always -1.

With this patch, mdadm will refuse to add a disk with non-matching
sequence number.

This fixes Francis Moreau's problem reported with subject
"mdadm 3.3 fails to kick out non fresh disk".

FIXME: More work is needed here. Currently mdadm won't even add the
disk to the container, that's wrong. It should be added as a spare.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-10-16 15:29:43 +11:00
mwilck@arcor.de a8b2563354 DDF: brief_examine_subarrays_ddf: print array name
Print an array name in brief output, like IMSM does.

SUSE's YaST2 (libstorage) needs this in order to detect MD arrays
during installation.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-09-12 15:44:10 +10:00
mwilck@arcor.de 8bf989d8e1 DDF: factor out array name generation
The same algorithm was used in getinfo_super_ddf_bvd and
container_content_ddf. Put it in a common function.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-09-12 15:44:10 +10:00
NeilBrown b95cb4b9d8 DDF: allow for possibility that there is no secondary copy of metadata.
If there isn't, we currently write the second copy at some
random location :-)

Reported-and-tested-by:  Francis Moreau <francis.moro@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-09-12 14:57:28 +10:00
NeilBrown 1c0aebc2be Move ARRAY_SIZE macro to common include file.
That was super-ddf can use it.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-09-10 09:48:06 +10:00
mwilck@arcor.de 7087f02b90 DDF: handle fake RAIDs with changing subarray UUIDs
Some fake RAID BIOSes (in particular, LSI ones) change the
VD GUID at every boot. These GUIDs are not suitable for
identifying an array. Luckily the header GUID appears to
remain constant.

We construct a pseudo-UUID from the header GUID and those
properties of the subarray that we expect to remain constant.
This is only array name and index; all else might change e.g.
during grow.

Don't do this for all non-MD arrays, only for those known
to use varying volume GUIDs.

This patch obsoletes my previous patch "DDF: new algorithm
for subarray UUID"

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-09-10 09:46:52 +10:00
mwilck@arcor.de 5684fff6f8 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>
2013-08-28 14:58:34 +10:00
mwilck@arcor.de 1219c77e72 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>
2013-08-28 14:58:15 +10:00
mwilck@arcor.de cc9bfd9ea4 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>
2013-08-28 14:58:02 +10:00
NeilBrown bb925ff08b 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>
2013-08-28 14:41:26 +10:00
mwilck@arcor.de 5daa35ac1a DDF: ddf_open_new: check device status for new subarray
It is possible that mdadm creates a new subarray containing failed
devices. This may happen if a device has failed, but the meta data
containing that information hasn't been written out yet.

This code tests for this situation, and handles it in the monitor.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-08 10:33:21 +10:00
NeilBrown 3921e41a9d DDF: Write new conf entries with a single write.
The recent change to skip over invalid conf entries was bad because
it could leave garbage on the disk.
But we don't to write each entry separately as the writes a O_DIRECT
and so synchronous so it takes way too long.

So allocate a large buffer (probably the one used to read the config records)
and fill that then write it all at once.

Reported-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-07 17:09:24 +10:00
mwilck@arcor.de 60056e1c3d DDF: get_extents: don't allocate space on failed disks
We should skip known failed disks when allocating space for
new arrays. This fixes the problem with 10ddf-fail-spare.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-06 09:54:47 +10:00
NeilBrown 92939eb291 DDF: fix removal of failed devices.
Commit c7079c84 arrange for DDF to forget about any device
that is failed and not still marked as part of any array.

However such devices could still be part of the container and this
removal and updating of 'pdnum' can result in multiple devices having
the same pdnum.  This in turn easily leads to confusion and
corruption.

So only discard pd entries for devices which are failed, not listed in
any virtual device, and for which we don't have a handle on the
device.

pd entries will not get removed until a new device is added after
the device has been removed from the container, either by
"mdadm --remove" or by assembling without the failed devices.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Analysed-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-05 15:10:05 +10:00
NeilBrown ce45c81986 DDF: fix writing metadata updates.
Recent commit 273989b93a
skipped writing some large blocks of 0xFF, but didn't seek
over the space, so subsequent data was written wrongly.

When we don't write, we need to seek.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-05 14:21:10 +10:00
mwilck@arcor.de 9591a2de77 DDF: no need for GET_LAYOUT any more
With the previous patch, mdmon will provide the layout property for us.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-05 11:31:56 +10:00
NeilBrown 273989b93a DDF: differentiate between new metadata and metadata updates.
When writing an update, we don't need to overwrite lots of
empty fields.  This makes updates somewhat faster.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-01 15:33:19 +10:00
NeilBrown cc83a81972 DDF: use some #defines instead of bare constants.
Signed-off-by: NeilBrown <neilb@suse.de>
2013-08-01 15:21:24 +10:00
Martin Wilck ce6844b99c DDF: ddf_set_disk: add some debug messages
Adds more verbose debugging in ddf_set_disk, to understand failures
better.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-31 12:47:44 +10:00
Martin Wilck 0e5fa86239 DDF: load_ddf_header: more error logging
Try to determine problem if load_ddf_header fails. May be useful
for determining compatibility problems with Fake RAID BIOSes.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-31 12:47:44 +10:00
Martin Wilck 0847945b8e DDF: ddf_process_update: log offsets for conf changes
I needed this for tracking a bug with wrong offsets after array
creation.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-31 12:47:44 +10:00
Martin Wilck 2a645ee220 DDF: log disk status changes more nicely
In particular, include refnum for better tracking. This makes
it a little easier for humans to track what happened to which disk.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-31 12:47:44 +10:00
Martin Wilck 6f56dbb970 DDF: ddf_activate_spare: bugfix for 62ff3c40
Move the check for good drives in the dl loop - otherwise dl
may be NULL and mdmon may crash.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-31 12:47:44 +10:00
NeilBrown 7ccc4cc4fc Manage: remove call to validate_geometry.
This call to validate_geometry is really rather gratuitous.
It is purely about the fact that super0 cannot use more than 4TB.
So just make it an explicit test - less confusing that way.

With this, validate_geometry is only called from Create, which
makes it easier to reason about.

Also validate_geometry is now never passed NULL for the 'chunk'
parameter, so we can remove those annoying tests for NULL.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-30 13:45:22 +10:00
mwilck@arcor.de 0c78849f2b DDF: ddf_activate_spare: fix metadata update for SVDs
Metadata updates for secondary RAID (RAID10) need to cover
all BVDs. Compare with code in write_init_super_ddf().

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-30 10:57:14 +10:00
mwilck@arcor.de 62ff3c40c1 DDF: ddf_activate_spare: only activate good drives
Do not try to activate drives marked missing or failed.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-30 10:57:13 +10:00
mwilck@arcor.de 7733b91d37 DDF: ddf_activate_spare: Add RAID10 code
The check for degraded array is a bit more complex for RAID10.
Fixing it.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-30 10:57:13 +10:00
mwilck@arcor.de 84e32e1977 DDF: find_vdcr: fix minor bug in debug message
This code could find disk -1. Fixed.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-30 10:57:13 +10:00
NeilBrown 4441541f1f super-ddf: allow mdassemble to compile.
Just add/move some #ifdefs and move some code.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-23 14:00:56 +10:00
mwilck@arcor.de a8173e4349 DDF: convert big-endian __u16 to be16 type
Last step of endian-safe recoding. This requires also bit
operations.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-23 13:53:34 +10:00
mwilck@arcor.de 9d0c6b7071 DDF: convert big-endian __u64 to be64 type
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-23 13:53:32 +10:00
mwilck@arcor.de 60931cf94a DDF: convert big endian to be32 type
Part 2 of endianness-safe conversion

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-23 13:49:41 +10:00
mwilck@arcor.de 4d1bdc1840 DDF: add endian-safe typedefs
This adds typedefs for big-endian numbers. This will hopefully
reduce the number of endianness bugs I make.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-23 13:49:11 +10:00
mwilck@arcor.de fbf0c2a7ac DDF: getinfo_super_ddf_bvd: fix offset calculation for SVDs
Fix a bug that caused the wrong conf record to be used to derive
data offset and size on secondary RAID (RAID10).

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
mwilck@arcor.de 6a350d82b9 DDF: kill_subarray_ddf: fix case without mdmon running
When mdmon wasn't runnning, meta data wasn't committed to disk.
Fixed.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
mwilck@arcor.de 2aba583f28 DDF: err_bad_md_layout: fix return value
This function must use -1 to indicate failure. Fix it.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
mwilck@arcor.de 9bf3870442 DDF: factor out writing super block to single disk
Factor out single disk from __write_init_super_ddf to a new function
_write_super_to_disk. Use this function in store_super_ddf.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
mwilck@arcor.de 8e9387ac9f DDF: make "null_aligned" a static buffer
Use a static buffer for this "zero page". This makes it easier
to factor out the header writing code.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
mwilck@arcor.de 35c3606df7 DDF: increase seq number in ddf_set_updates_pending
Increase seq number only when there's actually a metadata change.
This is better then increasing it at every write.

This also fixes another endianness bug.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
NeilBrown 3eff7c1d2f DDF load headers: if primary is invalid, don't check fields.
Currently we compare fields between primary and secondary
superblocks, before we check if the primary is even valid.
This is a bit backwards, so reverse it.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:47:22 +10:00
mwilck@arcor.de c5943560f8 DDF: ddf_process_update: Fix updates for SVDs
The "indirect" code path for adding VDs was not working correctly
for secondary RAID level. The "other BVDs" were not transmitted
to mdmon. Thus mdmon wouldn't build up correct information, and
RAID creation would fail when mdmon was already running on the container.

This patch fixes this.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:43:05 +10:00
mwilck@arcor.de ed5ff7a22b DDF: ddf_process_update: some more debug messages
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:43:01 +10:00
mwilck@arcor.de 4a03cbd10b DDF: guid_str: more readable output
Print ASCII characters as ASCII

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:42:17 +10:00
mwilck@arcor.de 6a7e7ecce9 DDF: ddf_process_update: add debug messages fore adding VDs
Add some debug messages for the DDF_VIRTR_RECORDS_MAGIC case.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:42:11 +10:00
mwilck@arcor.de 4f9bbe63c1 DDF: add debug message in add_super_ddf_bvd
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:42:01 +10:00
mwilck@arcor.de ad60eea1e2 DDF: fix endianness of refnum in debug messages
This makes it easier to match the debug output to existing
structures.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:41:50 +10:00
mwilck@arcor.de 7c3fb3ecb3 DDF: getinfo_super_ddf_bvd: fix raid_disk calculation
The return value of disk.raid_disk may be wrong.
The old code was using raiddisk, which is only valid with auto
layout. This leads to errors when arrays are created with
specified disks and mdmon is already running, like this:

mdadm -CR /dev/md/container -n5 $d1 $d2 $d3 $d4 $d5
mdadm -CR /dev/md/r5 -n5 -l5 /dev/md/container -z 5000
mdadm -CR /dev/md/r1 -n2 -l1 $d1 $d2
  => resulting array will use wrong disks

This patch fixes that.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:41:34 +10:00
mwilck@arcor.de f5ded78768 DDF: getinfo_super_ddf_bvd: identify disk by refnum
Use refnum rather than raiddisk for identifying the physical disk.
raiddisk should only be used for auto-layout.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:41:18 +10:00