Commit Graph

332 Commits

Author SHA1 Message Date
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
mwilck@arcor.de f646805e80 DDF: implement kill_subarray
Implement kill_subarray, for mdmon running and not running.

The way Kill_subarray() is implemented, this requires that the
DDF layer uses "currentconf" to remember the last subarray
queried with container_content(), and use it as the one to kill.
I don't like this much but IMSM does it the same way.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:40:43 +10:00
mwilck@arcor.de 19041058d2 DDF: write_init_super_ddf: don't zero superblocks for subarrays
commit d682f344 inserted this call to "Kill" in write_init_super_ddf:

    "Matching the functionality already in super0 and super1, when
    we first create a container, remove any other recognisable metadata to
    ensure it doesn't cause confusion."

But we should do this only at first container creation, not when
subarrays are created later.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-10 10:40:18 +10:00
mwilck@arcor.de 5838fccdd2 DDF: ddf_process_update: Fix vlist treatment for SVDs
With secondary RAID level, disks may belong to other BVDs in
a given conf record. This needs to be taken into account
when fixing the vlist.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:50 +10:00
mwilck@arcor.de 21a635519e DDF: ddf_process_update: handle update of conf records for SVD
For secondary RAID, we need to check which BVD needs to be updated.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:46 +10:00
mwilck@arcor.de b27336a28e DDF: ddf_set_array_state: more meaningful output
Print the array GUID and the array state.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:43 +10:00
mwilck@arcor.de be9b9ef42e DDF: guid_str: convenience function to print GUID for debugging
For debugging DDF structure changes, it is important to be able
to identify VCs by their GUIDs.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:41 +10:00
mwilck@arcor.de ddf94a437e DDF: getinfo_super_ddf_bvd: lba_offset calculation for RAID10
Secondary RAID needs some extra logic here, too.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:37 +10:00
mwilck@arcor.de 63eb245403 DDF: add_to_super_ddf_bvd: use get_svd_state()
Reuse get_svd_state() rather than own state algorithm.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:50:33 +10:00
mwilck@arcor.de 475ccbdbf6 DDF: add_to_super_ddf: RAID10 changes
The index in the BVD may be different in the RAID10 case.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:49:32 +10:00
mwilck@arcor.de 4ee8cca90e DDF: add_to_super_ddf: Use same amount of workspace as other disks
If there are already disks in the container, reserve the same amount
of workspace as the first disk. Fill in the primary/secondary/
workspace LBA values.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:49:28 +10:00
mwilck@arcor.de 4a3ca8acc3 DDF: add_to_super_ddf: allow empty slots in phys disk table
The used slots in the phys disk table aren't necessarily the
first ones. Rather, unused entries are represented by entries
where the GUID is all 0xff.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:49:25 +10:00
mwilck@arcor.de fcc22180b1 DDF: get_extents: support secondary RAID level
Use get_pd_index_from_refnum() in get_extents to determine
matching VD. This will ensure RAID 10 (secondary RAID level)
support, too.

This also fixes a bug in the previous get_extents() code (missing
__be16_to_cpu for conf.prim_elmnt_count).

DDF test case (10ddf-create) verified.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:49:23 +10:00
mwilck@arcor.de 57a666623d DDF: use LBA_OFFSET macro instead of lba_offset field
Remove the lba_offset field from struct vcl. This field acted as
a "cache" for the address of the lba_offset field in the vd_config
structure. This isn't useful any more if there are multiple
vd_configs in a vcl.

This patch also adds __cpu_to_be64 in two places where it has been
quite obviously forgotten (ddf_set_disk, ddf_activate_spare).

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:48:36 +10:00
mwilck@arcor.de 94b08b7c31 DDF: validate_geometry_ddf: support RAID10
Make validate_geometry_ddf() use the same logic to check supported
RAID levels that init_super_ddf_bvd() uses.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:48:34 +10:00
mwilck@arcor.de 5aaf6c7b5d DDF: init_super_ddf_bvd: initialize other bvds
Properly initialize the data structures of the other BVDs
in Create().

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:48:32 +10:00
mwilck@arcor.de 3c48f7be46 DDF: Simplify allocation of "other BVDs"
Instead of allocating the other_bvds array and every element
separately, allocate all in a single chunk. Also, move allocation
in a subroutine as it's used in several places.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:48:30 +10:00
mwilck@arcor.de a3163bf069 DDF: layout_md2ddf: new md->DDF layout conversion
Support for RAID 10 makes it necessary to rewrite the algorithm
for deriving DDF layout from MD layout. The functions level_to_prl
and layout_to_rlq are combined in a single function that takes
md layout parameters and converts them to DDF.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 16:46:32 +10:00
mwilck@arcor.de 8a2848a700 DDF: layout_ddf2md: new DDF->md RAID layout conversion
layout_ddf2md() is a new RAID layout conversion routine.
It obsoletes the previous separate routines for obtaining
md level and layout (map_num1, rlq_to_layout).

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de fb9d0acbbc DDF: allow empty slots in virt disk table
The DDF code was assuming that the VD slots 0..populated_vdes
were used and the rest was unused. Remove this assumption and
deal with empty slots instead.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de 0777d17d58 DDF: get_svd_state: Status logic for secondary RAID level
Implement logic to derive the status of a secondary RAID
from its members. Use it in ddf_set_disk.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de 5ec636b7ad DDF: ddf_set_disk: move status logic to separate function
Moved code to determine RAID status to a separate function
get_bvd_status(). I need this to account for secondary RAID level.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de baba3f4e81 DDF: find_vdcr: account for secondary RAID level
If secondary RAID level is taken into account, translation between
the md RAID member (raid_disk) and the index of a physical disk
in a BVD becomes more complex.

Also, take into account that the member list can have unused entries
(this is independent of secondary RAID level).

Adapt usage of find_vdcr() accordingly

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de a2aa439e99 DDF: ddf_open_new: implement minimal consistency check
Added a minimal consitency check as in imsm_open_new().

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de dbf98368fe DDF: Implement store_super_ddf
This patch implements the previously unsupported case where
store_super_ddf is called with a non-empty superblock.

For DDF, writing meta data to just one disk makes no sense.
We would run the risk of writing inconsistent meta data
to the devices. So just call __write_init_super_ddf and
write to all devices, including the one passed by the caller.

This patch assumes that the device to store the superblock on
has already been added to the DDF structure. Otherwise, an
error message will be emitted.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de a4057a88a2 DDF: handle "open flag" according to spec
The DDF spec mandates that the "open flag" be set to non-0 before
writing a configuration, and reset to 0 when finished to indicate
success.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de dbeb699a77 DDF: load_ddf_headers: use secondary header as fallback
When the primary header can't be read, use the secondary header
as fallback.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de c98567bac1 DDF: check_secondary: fix treatment of missing BVDs
Unused BVDs should just be skipped instead of bailing out.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:31 +10:00
mwilck@arcor.de d6e7b0837d DDF (cleanup): use a common macro for failed searches
Use DDF_NOTFOUND instead of NO_SUCH_REFNUM.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-08 15:28:30 +10:00
NeilBrown ed503f89e4 Change some "fprintf(stderr,"s to pr_err.
They just keep slipping in..

Signed-off-by: NeilBrown <neilb@suse.de>
2013-05-21 12:42:57 +10:00
NeilBrown 74db60b00a Add --dump / --restore functionality.
This allows the metadata on a device to be saved and later restored.
This can be useful before experimenting on an array that is misbehaving.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-05-16 15:07:16 +10:00
NeilBrown b31df43682 intel,ddf: don't require partitions when ignore_hw_compat is set.
Partitions are a hw-compat issue.

This allows e.g "--examine" to be used on image files.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-05-16 13:24:07 +10:00
mwilck@arcor.de 3f188b1081 DDF: fix bug in compare_super_ddf
Fix bug in previous patch
"DDF: compare_super_ddf: merge local info of other superblock"

Just discovered this bug in my last patch set - unfortunately, just after
you committed it.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-04-24 16:33:46 +10:00
mwilck@arcor.de 7d5a7ff3da DDF: add code to debug state changes
The 10ddf-create test case fails sporadically because wrong meta
data is written, making the array appear inconsistent when it's
restarted. Added code to aid debugging this.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-04-23 14:55:32 +10:00
mwilck@arcor.de bedbf68a08 DDF: brief_detail_super_ddf: print correct UUID for subarrays
Commit c1ea5a98 caused brief_detail_super_ddf() to be called
for subarrays. But the UUID printed was always the one of the
container. This is wrong and actually worse than printing no UUID
at all, and causes the DDF test case (10ddf-create) to fail.

This patch adds code to determine the MD UUID of a subarray correctly.
The hard part is to figure out for which subarray the function is
called. Moved that to an extra function.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-04-23 14:55:31 +10:00
mwilck@arcor.de dc9e279c13 DDF: __write_init_super_ddf: just use seq number of active header
It's not necessary to check for 0xffffffff, which is a valid
sequential number.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-04-23 14:55:31 +10:00
mwilck@arcor.de dacf3dc5d4 DDF: __write_ddf_structure: Fix wrong reference to ddf->primary
Should reference "header" instead here.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-04-23 14:55:31 +10:00
mwilck@arcor.de 4eefd651f0 DDF: compare_super_ddf: merge local info of other superblock
If a match is found in compare_super_ddf, check the other SB
for local DDF information (VD config records, physical disk data)
which is not available in the current superblock, and add it
if needed.

This is important for the mdmon - when disks are added to a
auto read-only array, they must be present in the DDF structure
in order to guarantee consistent writeback of metadata to all
disks.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:15:06 +11:00
mwilck@arcor.de 2d21069764 DDF: add sanity checks in compare_super_ddf
Besides container GUID, also check seqnum, physical and virtual
disk numbers, and check match between local and global sections.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:14:17 +11:00
mwilck@arcor.de e3c2a365e9 DDF: __write_init_super_ddf: use correct VD conf
When writing back the DDF structure, make sure that on each disk
we write the configs that include this disk even if a secondary
RAID level is present. Otherwise the secondary RAID will not be
read correctly any more when we open the device next time.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:13:21 +11:00
mwilck@arcor.de 4e5870181a DDF: container_content_ddf: handle RAID layout for RAID10
This patch adds basic handling for the special case of RAID10.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:10:38 +11:00
mwilck@arcor.de a5c7adb310 DDF: container_content_ddf: check for secondary RAID
Check for supportable secondary RAID configurations.
There is currently only one: RAID 10, if the stripe
sizes and Basic volume sizes are all equal.

With this patch, mdadm will not try to start unsupported
secondary RAID level configurations any more.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:08:46 +11:00
mwilck@arcor.de 8a38db8674 DDF: container_content_ddf: change array disk search loop
When searching for container elements, loop over the known phys
disks rather than the elements of the current configuration.

This patch changes nothing in the logic or return value of the code.
It just prepares extended logic for handling RAID10.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:07:09 +11:00
mwilck@arcor.de 3dc821b091 DDF: load_ddf_local: store VD conf for other BVDs
Store VD config for other BVDs in the other_bvds array.
This allows handling secondary RAID levels in container_content_ddf.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 16:03:44 +11:00
mwilck@arcor.de 8ec5d68536 DDF: added other_bvd to struct vcl
The VD config structures of different BVDs in the same SVD may be
different. This pointer stores the other BVDs.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 15:59:38 +11:00
mwilck@arcor.de 0175cbf62c DDF: increase seq number when writing meta data
Cleanly increase the seq number when the DDF structures are
written, instead of always setting it back to 1.

Also, make sure that the sequential number of all headers and
VD conf records is the same.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 14:29:59 +11:00
mwilck@arcor.de 097bcf0057 DDF: use existing locations for primary and secondary DDF structure
Some RAID BIOSes apparently use hard-coded LBA offsets (presumably
from the end of the disk) for the primary and secondary DDF
structure, ignoring the values given in the DDF anchor. This is
broken BIOS behavior, but it will cause any changes made by MD
(e.g. setting the init_state flag after a full initialization)
to be "forgotten" after the next reboot.

This patch fixes this by using the exiting LBA locations if
available. Verified that this fixes MD+LSI Mega Software RAID
BIOS.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 14:19:50 +11:00
mwilck@arcor.de 7f798aca5b DDF: cleanly save the secondary DDF structure
So far, mdadm only saved the header of the secondary structure.
With this patch, the full secondary DDF structure is saved
consistently, too. Some vendor DDF implementations need it.

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-03-04 14:19:50 +11:00
NeilBrown 4dd2df0966 Discard devnum in favour of devnm
We widely use a "devnum" which is 0 or +ve for md%d devices
and -ve for md_d%d devices.
But I want to be able to use md_%s device names.

So get rid of devnum (a number) and use devnm (a 32char string).
eg.
  md0
  md_d2
  md_home

Signed-off-by: NeilBrown <neilb@suse.de>
2013-02-21 17:05:23 +11:00
NeilBrown 5d5002289c Replace a lot of leading spaces with tabs.
Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-10 18:33:26 +11:00
NeilBrown 72ca9bcff3 Allow data-offset to be specified per-device for create
mdadm --create /dev/md0 .... /dev/sda1:1024 /dev/sdb1:2048 ...

The size is in K unless a suffix: K M G is given.
The suffix 's' means sectors.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-04 16:34:21 +10:00
NeilBrown 83cd1e97cb Add data_offset arg to ->init_super and use it in super1.c
So if ->data_offset is already set, use that rather than
computing one.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-04 16:34:20 +10:00
NeilBrown af4348ddd1 Add data_offset arg to ->validate_geometry.
This is needed to return correct available size.  It isn't
really used yet.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-04 16:34:20 +10:00
NeilBrown 387fcd593c Add data_offset arg to ->avail_size
This is currently only useful for 1.x metadata and will allow an
explicit --data-offset request on command line.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-04 16:34:20 +10:00
NeilBrown 542ef4ece4 ddf: hack to fix container recognition.
When adding a spare to a DDF there is some confusion about the
'level' of the container.  It is reported by kernel as unknown
 -1000000.
I don't know why this broke but until I figure out why and fix it,
this hack gets us going again.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-08-15 10:07:26 +10:00
NeilBrown e0e7aeaa18 ddf: allow a non-spare to be used to recovery a missing device.
If a DDF has two arrays sharing devices and one device fails, then
as soon as the spare is used to recover one of the arrays it isn't
spare any more and so is not chosen for the other array.

Work around this for now by allowing a non-spare to be used if it has
enough space.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-08-15 09:59:55 +10:00
NeilBrown 613b0d174d ddf: fix multiple white-space issues.
Just general tidy-up

Signed-off-by: NeilBrown <neilb@suse.de>
2012-08-15 09:55:40 +10:00
NeilBrown ba728be72f Convert 'quiet' to 'not verbose' in various places.
If we change some functions to accept 'verbose', where <0 means to be
quiet, in place of 'quiet', then we will be able to merge
'quiet' and 'verbose' together for simplicity.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:18:09 +10:00
NeilBrown 503975b9d5 Remove scattered checks for malloc success.
malloc should never fail, and if it does it is unlikely
that anything else useful can be done.  Best approach is to
abort and let some super-daemon restart.

So define xmalloc, xcalloc, xrealloc, xstrdup which don't
fail but just print a message and exit.  Then use those
removing all the tests for failure.

Also replace all "malloc;memset" sequences with 'xcalloc'.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:14:16 +10:00
NeilBrown e7b84f9d50 Introduce pr_err for printing error messages.
'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": '
cont_err() is also available.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:14:16 +10:00
Jes Sorensen 42d5dfd99d __write_init_super_ddf(): Use posix_memalign() instead of static aligned buffer
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-03-21 08:07:12 +11:00
Jes Sorensen 90fa1a2929 Work around gcc-4.7's strict aliasing checks
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-01-12 10:41:49 +11:00
NeilBrown 7b80ad6af2 ddf: fix auto-allocation problem.
We need to check every disk to see if it has a particular amount of
space spare, not just every subsequent disk.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-12-23 09:04:59 +11:00
Adam Kwolek 6e75048bc5 Add recovery blocked field to mdinfo
When container is assembled while reshape is active on one of its member
whole container can be required to be blocked from monitoring.
For such purpose field recovery blocked is added to mdinfo structure.

When metadata handler finds active reshape in container it should set
recovery_blocked field to disable whole container monitoring during
reshape.

For arrays that doesn't use containers, recovery_blocked field
has the same value as reshape_active field e.g. super0/1.
In fact,recovery is blocked during reshape for such arrays.
For ddf, metadata handler doesn't set reshape_active field,
so recovery_blocked is not set also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-10-05 13:30:50 +11:00
NeilBrown fb204fb2e1 ddf: fix up getinfo_super_bvd
Now that getinfo_super clears the info structure, we need
to make sure the correct values are filled in to info->dev.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 15:49:23 +10:00
NeilBrown 9894ec0d64 Fix some fall-out from recent memset-zero for getinfo_super
container_content_imsm was setting info->next before calling
getinfo_super_imsm_container which now zeros everything.
So move that assignment to afterwards.

So both imsm and ddf were assuming info->disk.raid_disk means
something but it doesn't.  So fix those.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 12:42:02 +10:00
NeilBrown 95eeceeb32 getinfo_super now clears the 'info' structure before filling it in.
Some code currently clears 'info' before calling getinfo_super,
some code doesn't.

To be consistent, change it so no caller ever clears 'info',
but ever getinfo_super function must clear it.

Note that ->raid_disk may be meaningful if that 'map' is passed
non-NULL.  In that case it is copied out before the structure
is zeroed.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 15:54:13 +10:00
NeilBrown 0cf5ef67bb ddf: fix up detection of failed/missing devices.
If a device hasn't been found yet we can still tell if it is
expected to be working, and we must to do to make sure
'working_disks' is correct.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-22 10:32:09 +11:00
NeilBrown 88b496c269 Merge branch 'master' into devel-3.2
Conflicts:
	Manage.c
	managemon.c
	super-ddf.c
	super-intel.c
2011-03-15 15:35:04 +11:00
NeilBrown b0edee6efb ddf: implement remove_from_super
This is needed to remove devices from mdmon's knowledge when the
device is removed from the md container.

Now that ddf have a remove_from_super we don't need the code
that allows some personalities not to implement this.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 15:10:32 +11:00
NeilBrown 33b0edd78a DDF Allow a RAID1 to be 'partially optimal'.
If a RAID1 is meant to have more than 2 device and while it doesn't
have that many, it still has more than 1, then according to the
DDF spec it is "partially optional" rather than "degraded"
So make that so.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 15:09:24 +11:00
NeilBrown c7079c8441 ddf: remove failed devices that are no longer in use.
The DDF spec requires we have a phys disk record for every physically
attached device.  But it isn't clear what that means in the case
of soft raid in a general purpose Linux computer.
So remove phys disk records for any failed device that is not
active in any array.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 15:02:49 +11:00
NeilBrown 8401644c3a ddf: set Rebuilding flag when adding devices to a degraded array
This is a big fragile, but DDF has wierd rules that we aren't really
set up to handle properly.

When we add a device to a degraded array it must be a spare, so
mark it as Rebuilding.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 14:57:46 +11:00
NeilBrown e5cc7d469f ddf: use correct loop variable in activate_spare
Using 'i' when you mean 'j' just shows how silly it is to use
variables named 'i' and 'j'.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 14:54:46 +11:00
NeilBrown 77632af906 ddf: Don't consider 'dl' entries with state_fd < 0
These have been marked as invalid (recently failed) so
don't trust the major/minor associated with them.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-15 14:53:00 +11:00
NeilBrown 4dd968cc54 ddf: implement remove_from_super
This is needed to remove devices from mdmon's knowledge when the
device is removed from the md container.

Now that ddf have a remove_from_super we don't need the code
that allows some personalities not to implement this.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:56:16 +11:00
NeilBrown f50ae22e45 ddf: zero space_list in ddf_activate_spare.
Currently ->space_list is uninitialised here, which is obviously bad.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:54:21 +11:00
NeilBrown de6a92199e Merge branch 'master' into devel-3.2 2011-03-14 18:49:57 +11:00
NeilBrown 1502a43a08 ddf: set vcnum correctly when creating a new virtual device in conflist
We weren't setting ->vcnum at all when an array was added.  This
meant that a subsequent device failure could be assigned to the
wrong array.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:47:47 +11:00
NeilBrown e1316fab98 ddf: teach set_disk to cope with new or changed devices.
When set_disk is called, we need to check if the disk has changed or
recently appeared, and update everything properly if it has.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:45:26 +11:00
NeilBrown 8a38cb04de ddf: free_super should be add_list as well.
It is possible there is data and even an open file descriptor
on 'add_list' - so it must be freed too.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:32:38 +11:00
NeilBrown 7590d5623b ddf: minor activate_super fixes.
1/ ignore devices with "state_fd < 0" as these have been removed.
2/ Set update 'length' properly and clear 'space'.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-14 18:30:34 +11:00
NeilBrown 18cb44962d ddf: Failed should suppress Online and others.
so the notes say, so make it so.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10 18:14:43 +11:00
NeilBrown ca6529edf6 Merge branch 'master' into devel-3.2
Conflicts:
	Grow.c
	Manage.c
	managemon.c
	mdadm.8.in
	util.c
2011-03-10 17:37:04 +11:00
NeilBrown 37e430d163 ddf: remove duplicate container_member setting.
We were setting ->container_member twice in ddf get_info.
Once to currentconf->vcnum,
once to atoi(st->subarray).

Both should be the same.
For consistency with super-intel, use the first.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10 17:24:44 +11:00
NeilBrown 002a3de3d4 ddf: fail creation of new subarray with same name as old.
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-10 17:20:25 +11:00
NeilBrown bb7295f15e Fix chunksize defaulting.
the new code for defaulting chunksizes didn't work quite right
 - default was set to late in super1/super0/ddf
 - defaults would over-ride values of '0' imposed by some levels
 - default value wasn't applied to size properly.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-09 18:27:19 +11:00
NeilBrown fa033beca9 ddf: exclude failed devices from container_content
If a device is failed, then don't include it in the reported
container_content, else it might get included in the array.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-03 09:04:42 +11:00
Czarnowska, Anna c21e737ba1 set default chunk in validate_geometry
When chunk size is not set from command line we need to guess it
depending on metadata given on command line or found on listed devices.

Validate_geometry sets the default for it's metadata if chunk is not set.
For external metadata chunk is set only when creating in a container.
For imsm validate_geometry_imsm_orom is responsible for finding default
chunk depending on container metadata loaded. Container will already know
which controller it is attached to, and have this controllers orom
available.
do_default_chunk indicates that we need to find default chunk and
if validate_geometry fails for some metadata it tells us to reset chunk
that may have been set.

Current solution would set default chunk correctly for imsm only if
container device was given on command line. With the list of devices
chunk was always set to 512.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-22 11:25:07 +11:00
NeilBrown 1cc7f4feb9 Don't close fds in write_init_super
We previously closed all 'fds' associated with an array in
write_init_super .. sometimes, and sometimes at bad times.
This isn't neat and free_super is a better place to close them.

So make sure free_super always closes the fds that the metadata
manager kept hold of, and stop closing them in write_init_super.

Also add a few more calls to free_super to make sure they really do
get closed.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-25 07:56:53 +11:00
NeilBrown 4a011f1009 load_super should not try to load_container
Now that load_container is a separate operation, load_super
should not try it first.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-12 16:18:04 +11:00
NeilBrown 97c9c10014 ddf: fail creation of new subarray with same name as old.
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-01 09:55:35 +11:00
NeilBrown f49208ec69 ddf: don't print warning on assemble
Now that we check the error return of 'update_super' better, we
much make sure that ddf doesn't incorrectly report that the
superblocks are wrong during assemble.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-01 09:47:21 +11:00
Dan Williams 30f58b2208 Create: cleanup/unify default geometry handling
Support metadata specific level, layout and chunksize defaults.  Kill an
uneeded superswitch methods ahead of adding more for the reshape case.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-23 15:20:50 +11:00
NeilBrown 157e6e24b9 Remove loaded_container
This field is now only set, never used.

So remove it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:06 +11:00
NeilBrown 47c74f3f50 Use load_container in Incremental assembly.
We more clearly separate out -I on a container, and use
load_container in that case and load_super only for true members.

This removes another use of loaded_container.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:57:58 +11:00
NeilBrown 2b959fbf66 New method: load_container
This handles the 'container' part of 'load_super', so we can
soon make them completely separate - it is just confusing to
overload these two.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown e1902a7b6c Remove keep_fd arg from load_super_XXX_all
It is always set to 1, so we don't need it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown 69b2fcc5bb Remove subarray field in supertype.
This is now only ever set, never used.
So remove it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown d1d599ea0d Create: user container_dev rather than subarray for some tests.
It makes more sense to test for container_dev than for subarray
for several places in Create where it then uses container_dev.

This allows us to subsequently remove subarray.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown 9b63e64836 Use container_member rather than subarray info ddf getinfo_super.
We are in the processes of discarding the subarray field, so remove
the unnecessary use of it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown e32bd33f44 Remove subarray detection from load_super.
Nothing relies on this any more, so remove it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:50 +11:00
NeilBrown 00bbdbdac6 Add subarray arg to container_content.
This allows the info for a single array to be extracted,
so we don't have to write it into st->subarray.

For consistency, implement container_content for super0 and super1,
to just return the mdinfo for the single array.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:26 +11:00
NeilBrown 8d86ffefdf ddf: remove duplicate container_member setting.
We were setting ->container_member twice in ddf get_info.
Once to currentconf->vcnum,
once to atoi(st->subarray).

Both should be the same.
For consistency with super-intel, use the first.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown a5d85af748 get_info_super: report which other devices are thought to be working/failed.
To accurately detect when an array has been split and is now being
recombined, we need to track which other devices each thinks is
working.

We should never include a device in an array if it thinks that the
primary device has failed.

This patch just allows get_info_super to return a list of devices
and whether they are thought to be working or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown 1e2b276535 Report error in --update string is not recognised.
If an --update is requested by the relevant metadata doesn't
understand it, print a useful message rather than silently ignoring
the issue.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:24 +11:00
NeilBrown f21e18ca89 Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 13:13:02 +10:00
NeilBrown 510242aa48 Restore assembling of ddf containers.
The container_enough code change broke ddf as ddf never claimed
'enough' devices.  So change it to always claim 'enough' to
restore previous behaviour.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-07-29 13:26:26 +10:00
Dan Williams d19e3cfb66 Merge branch 'fixes' into for-neil 2010-07-01 17:36:11 -07:00
Dan Williams b526e52dc7 Always assume SKIP_GONE_DEVS behaviour and kill the flag
...i.e. GET_DEVS == (GET_DEVS|SKIP_GONE_DEVS)

A null pointer dereference in Incremental.c can be triggered by
replugging a disk while the old name is in use.  When mdadm -I is called
on the new disk we fail the call to sysfs_read().  I audited all the
locations that use GET_DEVS and it appears they can tolerate missing a
drive.  So just make SKIP_GONE_DEVS the default behaviour.

Also fix up remaining unchecked usages of the sysfs_read() return value.

Reported-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-16 17:26:04 -07:00
Dan Williams 33414a0182 Kill subarray v2
Support for deleting a subarray out of a container.  When all subarrays
are deleted the component devices are converted back into spares, a
--zero-superblock is still needed to kill the remaining metadata at this
point.  This operation is blocked when the subarray is active and may
also be blocked by the metadata handler when deleting the subarray might
change the uuid of other active subarrays.  For example, with imsm,
deleting subarray 'n' may change the uuid of subarrays with indexes > n.

Deleting a subarray needs to be a container wide event to ensure
disks that record the modified subarray list perceive other disks that
did not receive this change as out of date.

Notes:
The st->subarray parsing in super-intel.c and super-ddf.c is updated to
be more strict now that we are reading user supplied subarray values.

Offline container modification shares actions that mdmon typically
handles so promote is_container_member() and version_to_superswitch()
(formerly find_metadata_methods()) to generic utility functions for the
cases where mdadm performs the operation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-15 17:55:41 -07:00
Dan Williams 97b4d0e971 Incremental: honor an 'enough' flag from external handlers
This is needed for imsm where:
1/ we want to report raid_disks as zero to allow mdadm -As to
   incorporate all spares
2/ we can't determine stale disks by looking at the event counts.
3/ we can't see per-subarray expectations with the info returned from
   the container level ->getinfo_super()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-26 13:22:36 -07:00
NeilBrown 691c6ee1b6 IMSM/DDF: don't recognised these metadata on partitions.
These metadata are not expected on partitions, and they have
no way of differentiation whether which is correct if they
are found both on the device and on the last partition.

So if the device is a partition, refuse to read the metadata.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-29 16:09:59 +10:00
NeilBrown d682f3445c ddf/intel: zero out old metadata before creating a container.
Matching the functionality already in super0 and super1, when
we first create a container, remove any other recognisable metadata to
ensure it doesn't cause confusion.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 15:55:47 +11:00
NeilBrown 624c5ad4cb Make sure reshape_active is cleared by getinfo_super
There were cases where --detail would report phantom reshapes.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 16:15:29 +11:00
NeilBrown d1d3482b56 config: add 'homehost' option to 'AUTO' line.
This allows basing auto-assembly decisions on whether
the array is recorded as belonging to this host or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 14:33:55 +11:00
NeilBrown 921d9e164f Assemble: fix --force assembly of v1.x arrays which are recovering.
1.x metadata allows a device to be a member of the array while it
is still recoverying.  So it is a working member, but is not
completely in-sync.

mdadm/assemble does not understand this distinction and assumes that a
work member is fully in-sync for the purpose of determining if there
are enough in-sync devices for the array to be functional.

So collect the 'recovery_start' value from the metadata and use it in
assemble when determining how useful a given device is.

Reported-by: Mikael Abrahamsson <swmike@swm.pp.se>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-02-04 12:02:09 +11:00
NeilBrown c1e3ab8c1e Merge branch 'master' of git://github.com/djbw/mdadm 2009-12-30 13:42:37 +11:00
NeilBrown 076515ba50 DDF: fix incorrect header magic number.
I was using the wrong magic number when creating an array.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-12-30 13:42:27 +11:00
Dan Williams d23534e464 Teach sysfs_add_disk() callers to use ->recovery_start versus 'insync' parameter
Also fixup 'in_sync' versus 'insync' typo.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-12-21 11:26:21 -07:00
Dan Williams b7528a20cc Introduce MaxSector
Replace occurrences of ~0ULL to make it clear we are talking about maximal
resync/recovery position.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-12-21 10:23:26 -07:00
Dan Williams b7941fd68d 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>
2009-12-14 12:57:55 -07:00
NeilBrown b42f577a0d 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.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 13:15:34 +11:00
NeilBrown f22385f982 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.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 12:30:54 +11:00
Dan Williams 955e9ea139 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>
2009-10-13 17:41:53 -07:00
NeilBrown 4737ae25de 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>
2009-08-07 14:17:40 +10:00
Dan Williams 148acb7baa 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>
2009-07-31 17:11:41 -07:00
Dan Williams 9b1fb67776 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>
2009-07-31 17:11:41 -07:00
Dan Williams 37424f132c 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>
2009-07-31 17:11:41 -07:00
Dan Williams af99d9ca67 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>
2009-07-31 17:08:22 -07:00
NeilBrown fa09d4961e 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>
2009-06-04 12:44:32 +10:00
NeilBrown e736b62389 Update copyright dates and remove references to @cse.unsw.edu.au
Also removed 'paper' addresses.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-06-02 14:35:45 +10:00
NeilBrown 061f2c6abd Make --brief even briefer.
Because ---examine --brief, or --detail --brief are
often used to create mdadm.conf, and because people don't want to
have to update their mdadm.conf unnecessarily, we don't want to
include information that might change.
And now that level changing is supported, that is almost everything
but UUID.

So move some more fields into the "Only print with --verbose" class.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:18:20 +10:00
NeilBrown c256924e52 Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0
Conflicts:
	Grow.c
	mdadm.h
	sysfs.c
Due to independent fixes for the "mdadm hangs if reshape finishes too quickly"
problem.
2009-04-14 11:11:14 +10:00
Dan Williams da9b4a62af imsm: set array size at Create/Assemble
imsm arrays round down the effective array size to the closest 1
megabyte boundary so teach get_info_super_imsm and sysfs_set_array to
set 'md/array_size' if available (and make sure ddf uses the default
size).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Doug Ledford c9b6907ba0 super-ddf: fix compile warnings on ppc64
Simple patch to silence some compile warnings that only show up on
64bit arches.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-08 17:25:52 +10:00
NeilBrown c0d50ca584 ddf: fixed 'working_disks' reported by container_content.
The 'work_disks' number should be the number that is expected, not the
number found so far.   This is needed for Incremental assembly to
start the array at the right time.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:41:55 +10:00
NeilBrown 962371a529 ddf: improve print out of physical devices.
Just add some more space really.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:40:24 +10:00
NeilBrown e223334fe7 ddf: fix variable name overload
The variable 'i' was being used as a loop variable, and also
for something else inside the loop.   So make the larger loop have a
more meaningful name.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:38:25 +10:00
NeilBrown ea17e7aa30 ddf: make sure Create fails if devices are too small.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-02 14:02:33 +11:00
NeilBrown 97320d7ca4 ddf: fix bug with error returns.
In some cases we should only print an error message if
'devname' is defined.  In fact we were only returning
the error at all in that case!!

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-02 13:37:34 +11:00
NeilBrown 661dce3617 mdmon: allow incremental assembly of containers.
If mdmon sees a device added to a container, it should assume it is
a new spare.  It could be a part of the array that just hadn't been
assembled yet.  So check first.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown bc17324f5e DDF: fix up container_content
If we haven't got hold of all the devices yet, we need to be
ready to skip over some while gathering content information.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown bfb7ea78e4 ddf: use better random number generation.
use /dev/urandom rather than calls to 'random()' if possible.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:18 +11:00