Commit Graph

332 Commits

Author SHA1 Message Date
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
NeilBrown bceedeec55 Examine: add examine_export for ddf and avoid crashes.
If the personality doesn't provide export_examine_super, don't crash.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 14:10:52 +11:00
NeilBrown e5a2a3cf8c ddf: fix memory corruption bug.
When adding to a point, you don't need to multiple by the size
of the pointer - C does that for you!
2009-03-09 13:55:59 +11:00
NeilBrown cfccea8c17 DDF: minor formatting improvement
avoid long lines in --examine output
2009-03-09 13:55:13 +11:00
NeilBrown b640a252ee Support new raid6 layouts needed for DDF
DDF raid6 layouts are subtly different from the standard 'md' layouts.
From 2.6.30 the kernel knows about these.
Teach mdadm about them, and also allow 'ddf' to set an appropriate default.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 11:16:53 +11:00
Dan Williams dab4a5134e sysfs: allow sysfs_read to detect and drop removed disks
All operations that rely on loading from an existing container (like
--add) will fail after a disk has been removed.  Provide an option to
skip missing / offline disks rather than abort.  We attempt to do this
in the load_super_{imsm,ddf}_all cases when mdmon is running i.e. we
already have a consitent version of the metadata running in the system.
Otherwise, we fail as normal and let the administrator fix up the
container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:56 -07:00
NeilBrown 45b662b611 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-12-18 16:58:25 +11:00
Dan Williams 4cce406959 introduce --detail-platform to display platform raid capabilities
Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
NeilBrown b06e30958b DDF: improve --examine output
Make this more readable and in line with other
metadata types by providing a table for the devices.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 17:10:43 +11:00
NeilBrown 8592f29d64 Create: support autolayout when creating in a DDF
If, when creating an array, a signal target device is given which
is a container, then allow the metadata handler to choose which
devices to use.
This is currently only supported for DDF.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 16:08:33 +11:00
Dan Williams f20c396836 allow add_to_super to return errors
Prepare add_to_super to validate disks against the platform capabilities

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:30:39 +11:00
NeilBrown a9e1c11d8b ddf: store homehost information to allow smooth assembly.
When we create our own ddf array, store the homehost in the vendor
information so it can be so to ensure 'LOCAL' name choices.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown 42dc2744a8 DDF: report member arrays in examine_brief.
Thus an auto-generated config file will list all the arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown db42fa9b21 DDF: fix irregularities with retrieval of 'name' from metadata.
It is only 16 bytes, not 32.  And is space padded, not nul terminated.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown cf8de6913b Don't give array name in --examine --brief output if it is doubtful.
Now that mdadm.conf doesn't need an array name, we don't need to
give one if the array cannot reliably provide one.
2008-11-04 20:50:38 +11:00
NeilBrown 4abe6b7086 ddf: get endian-ness of CRC correct.
All numeric fields in a DDF header big-endian, including the CRC, so
better fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-10-27 10:04:46 +11:00
Dan Williams e6b9548dce non-trivial warn_unused_result fix, prepare_update
If an allocation fails in ->prepare_update we need to catch it in
->process_update.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
Dan Williams 792449393d non-trivial warn_unused_result fixes, activate_spare
Both super-ddf and super-intel ignore memory allocation failures during
->activate_spare.  Fix these up by cancelling the activation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
Dan Williams 175593bf28 non-trivial warn_unused_result fixes, write_init_super_ddf
When a write fails just move on to the next disk.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
Dan Williams 3d2c4fc7b6 trivial warn_unused_result squashing
Made the mistake of recompiling the F9 mdadm rpm which has a patch to
remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots
of errors:

config.c:568: warning: ignoring return value of asprintf
Assemble.c:411: warning: ignoring return value of asprintf
Assemble.c:413: warning: ignoring return value of asprintf
super0.c:549: warning: ignoring return value of posix_memalign
super0.c:742: warning: ignoring return value of posix_memalign
super0.c:812: warning: ignoring return value of posix_memalign
super1.c:692: warning: ignoring return value of posix_memalign
super1.c:1039: warning: ignoring return value of posix_memalign
super1.c:1155: warning: ignoring return value of posix_memalign
super-ddf.c:508: warning: ignoring return value of posix_memalign
super-ddf.c:645: warning: ignoring return value of posix_memalign
super-ddf.c:696: warning: ignoring return value of posix_memalign
super-ddf.c:715: warning: ignoring return value of posix_memalign
super-ddf.c:1476: warning: ignoring return value of posix_memalign
super-ddf.c:1603: warning: ignoring return value of posix_memalign
super-ddf.c:1614: warning: ignoring return value of posix_memalign
super-ddf.c:1842: warning: ignoring return value of posix_memalign
super-ddf.c:2013: warning: ignoring return value of posix_memalign
super-ddf.c:2140: warning: ignoring return value of write
super-ddf.c:2143: warning: ignoring return value of write
super-ddf.c:2147: warning: ignoring return value of write
super-ddf.c:2150: warning: ignoring return value of write
super-ddf.c:2162: warning: ignoring return value of write
super-ddf.c:2169: warning: ignoring return value of write
super-ddf.c:2172: warning: ignoring return value of write
super-ddf.c:2176: warning: ignoring return value of write
super-ddf.c:2181: warning: ignoring return value of write
super-ddf.c:2686: warning: ignoring return value of posix_memalign
super-ddf.c:2690: warning: ignoring return value of write
super-ddf.c:3070: warning: ignoring return value of posix_memalign
super-ddf.c:3254: warning: ignoring return value of posix_memalign
bitmap.c:128: warning: ignoring return value of posix_memalign
mdmon.c:94: warning: ignoring return value of write
mdmon.c:221: warning: ignoring return value of pipe
mdmon.c:327: warning: ignoring return value of write
mdmon.c:330: warning: ignoring return value of chdir
mdmon.c:335: warning: ignoring return value of dup
monitor.c:415: warning: rv may be used uninitialized in this function

...some of these like the write() ones are not so trivial so save those
fixes for the next patch.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
Dan Williams 593add1b56 monitor: protect against CONFIG_LBD=n
md/resync_start reports different terminal values depending on kernel
configuration (~0UL versus ~0ULL).  Make detection of the
resync-complete state more robust by comparing against array size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:51 -07:00
NeilBrown ff54de6e47 Report uuid in --detail --brief for ddf and intel
The uuid is slightly fictitious but needed for array matching.
2008-09-18 16:11:40 +10:00
NeilBrown 51006d8586 Add uuid support for super-intel.
'imsm' does not provide any real uuid, so we synthesise one
from various stable bits of the superblock.
2008-09-18 16:07:32 +10:00
NeilBrown c5afc314e2 Lots of fixes to make incremental assembly of containers work.
So:
  mdadm -I /dev/whatever

will (if appropriate) add whatever to a container, then start
any arrays inside the container.
2008-09-18 16:03:05 +10:00
NeilBrown 352452c364 Handle incremental assembly of containers.
mdadm -I /dev/part-of-container

should add that to a container, creating if it needed,
and then try to assemble any arrays in the container.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 16:01:57 +10:00
NeilBrown f35f252592 Move calls to SET_ARRAY_INFO to common helper.
When we assemble an array, there are three different approaches
depending on whether metadata is internal or external, and on
kernel version.

Move all this to a common helper instead of duplicating in 3 places.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 16:01:55 +10:00
NeilBrown 0e60042683 Compile fixes, particularly moving more stuff under MDASSEMBLE
Now 'make everything' works again.
2008-09-18 15:04:47 +10:00
Dan Williams a67dd8cc58 Allow metadata handlers to communicate desired safemode delay via mdinfo
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-09-15 20:58:42 -07:00
NeilBrown 567df5fd0a Fix bug with ddf if devices have different sizes.
We cannot use the header of the 'best' device to find the
sections on the other devices!!


Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:55:15 +10:00
NeilBrown 2cc2983d80 Provide ddf support for adding a device to an active container.
Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:55:15 +10:00
NeilBrown 01f157d74a Extra option for set_array_state: you choose dirty or clean.
When we first start an array, it might be good to start recovery
straight away.  That requires setting the array to 'dirty', but
only the metadata handler can know if that is required or not.
So have a third possible 'consistent' option to set_array_state.
Either 'no' or 'yes' or 'you choose'.

Return value indicates what was chosen.

'1' (no) should be chosen unless there is a good reason.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 14:54:55 +10:00
Neil Brown 103f2410ec Make sure resync_start is initialised properly and maintained properly
Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:04 +10:00
Neil Brown 120f767760 ddf: endian fixes.
We forgot to convert endian for lba_offset at one point,
and use le32 instead of be32 right nearby!!

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:03 +10:00
Neil Brown 2c514b7120 Pass 'verbose' flag to validate_geometry
That way it can be silent when we are just trying to figure out
which metadata to use, and noisy when detecting a real problem.
2008-07-12 20:28:38 +10:00
Neil Brown 6416d5275d Use O_DIRECT for all IO to devices.
Using buffered IO risks non-atomic updates to parts of the
device that we don't actually want to write to.  This isn't in
general safe.
So switch to O_DIRECT for all that IO and make sure we have
properly aligned buffers.
2008-07-12 20:28:33 +10:00
Neil Brown 3576e302fe ddf: Set container_member from subarray in getinfo_super.
Also go direct from subarray to text_version.
2008-07-12 20:27:42 +10:00
Neil Brown 18a2f463fd Reduce the number of metadata updates done by ddf.
1/ track if there are any actual updates pending, and only
   write metadata when we have changed something.

2/ when writing null virtual-configs, write full blocks,
   not just the first 4 bytes.  This will allow O_DIRECT
   writes in a subsequent patch.
2008-07-12 20:27:42 +10:00
Neil Brown a35c070bcd Remove some noisy printfs. 2008-07-12 20:27:41 +10:00
Neil Brown edd8d13c02 Create arrays via metadata-update
Support creating arrays inside an active ddf container by
sending a metadata update over a pipe to mdmon.
2008-07-12 20:27:40 +10:00
Neil Brown 78e449282e Remove the multiple super_switchs for ddf.
It is simpler if there is just one, and the methods
make decisions as appropriate.
2008-07-12 20:27:39 +10:00
Neil Brown ba7eb04f71 Remove silly convention that major='-1' means 'zero superblock'.
Use 'info pointer is NULL' instead.
2008-07-12 20:27:39 +10:00
Neil Brown d2ca644994 Remove getinfo_super_n and do some other cleaning up.
Getting close to a sensible description of what some of the
superswitch methods are supposed to do!
2008-07-12 20:27:39 +10:00
Neil Brown 0d481d3723 External metadata shouldn't set array.*_version
It doesn't mean anything and is never used.
2008-07-12 20:27:39 +10:00
Neil Brown f7e7067b47 Add subarray field to supertype.
When loading the metadata for a subarray (super_by_fd), we set
->subarray to be the name read from md/metadata_version so that
getinfo_super can return info about the correct array.

With this we can differentiate between a container and
an array within the container by looking at ->subarray[0].
2008-07-12 20:27:38 +10:00
Neil Brown 0063ecba3d Hide subordinate superswitch structures.
Only one superswitch should be externally visible for each
general type.  Others which handle different flavours
(e.g. container/data-array) should be internal only.
2008-07-12 20:27:38 +10:00
Neil Brown b8ac196795 Remove 'major' from superswitch.
It isn't generally meaningful.
2008-07-12 20:27:37 +10:00
Neil Brown 59e3626815 Assorted cleanups to DDF 2008-07-12 20:27:37 +10:00
Neil Brown 6264b43733 Always zero a struct ddf_super on allocation. 2008-07-12 20:27:36 +10:00
Neil Brown ef60947720 Always initialise a struct super_type to zero 2008-07-12 20:27:36 +10:00
Neil Brown 904c1ef77b Fix freeing of updates that have been handled by monitor.
Yes, we do want to free the buf, and the space too if it is still
there.
2008-07-12 20:27:33 +10:00
Dan Williams c42ec1ed43 ddf: fix up validate_geometry to ignore other containers
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-06-13 17:27:30 -07:00
Dan Williams 1ba6bff902 ddf: fix 'ddf' pointer corruption
hostname[17] = 0 overwrites the last byte of the ddf pointer

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-06-13 17:27:30 -07:00
Dan Williams 56aca704a5 ddf: convert size paramter to sectors when calling avail_size_ddf
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-06-13 17:27:30 -07:00
Neil Brown 7e1432fb14 Add DDF code for activate_spare
Plus various bug fixes etc.
2008-06-12 10:13:32 +10:00
Neil Brown 57632f4afb Some fixes to make failures in ddf get handled properly. 2008-06-12 10:13:28 +10:00
Neil Brown 80d26cb2fd Correctly set resync_start when creating an array. 2008-06-12 10:13:26 +10:00
Neil Brown 5575e7d962 DDF: Update array state and disk state properly when adding to a BVD 2008-06-12 10:13:25 +10:00
Neil Brown 88c164f42b super method for updating ddf metadata. 2008-06-12 10:13:24 +10:00
Neil Brown 2e735d1982 Allow passing metadata update to the monitor.
Code in manager can now just call queue_metadata_update with a
(freeable) buf holding the update, and it will get passed to the
monitor and written out.
2008-06-12 10:13:23 +10:00
Neil Brown b228067720 Store and recover spare_assign info in DDF. 2008-06-12 10:13:22 +10:00
Neil Brown 8c3b8c2c11 Add mppe and conf_rec_len to struct super_ddf
Rather than having to pull them from inside structures and
be_to_cpu them all the time.
2008-06-12 10:13:20 +10:00
Neil Brown 60f18132be Fix some stuff. 2008-05-27 09:18:58 +10:00
Neil Brown cba0191bad Parse the 'instance' part of external:/mdXX/INST in metadata handler.
This give more flexability.
2008-05-27 09:18:57 +10:00
Neil Brown dd15dc4a4d Discard st->container_member
'container_member' isn't really a well defined concept.
Each metadata might enumerate members differently, so just
let each format /mdX/YYYY as appropriate.
2008-05-27 09:18:56 +10:00
Neil Brown 159c3a1a77 Remove st->text_version in favour of info->text_version
I want the metadata handler to have more control over the 'version',
particularly for arrays which are members of containers.
So discard st->text_version and instead use info->text_version
which getinfo_super can initialise.
2008-05-27 09:18:55 +10:00
Neil Brown ed9d66aade Change mark_clean to set_array_state.
DDF needs more fine grained understanding of the array state.
2008-05-27 09:18:54 +10:00
Neil Brown 75aa18b53c Start mdmon during incremental assembly of container 2008-05-27 09:18:52 +10:00
Neil Brown 25dbe93ab4 allow --incremental to reuse devices that already exist
.. and other fixes.
2008-05-27 09:18:43 +10:00
Neil Brown 7a7cc50430 Set status of devices in ddf.
Might work a little bit....
2008-05-27 09:18:38 +10:00
Neil Brown 4e5528c6f7 Implement mark_clean for ddf and remove mark_dirty and mark_sync
mark_dirty is just a special case of mark_clean - with sync_pos == 0.
mark_sync is not required.  We don't modify the metadata when sync
finishes.  Only when the array becomes non-writeable at which point we
use mark_clean to record how far the resync progressed.
2008-05-27 09:18:38 +10:00
Neil Brown a2349791da Fix some initialisations... 2008-05-15 16:48:57 +10:00
Dan Williams 8d45d1969b handle disk failures
From: Dan Williams <dan.j.williams@intel.com>

Added curr_state as a parameter to set_disk.  Handlers look at this to
record components failures, and set global 'degraded' or 'failed'
status.

When reading the state as faulty:
1/ mark the disk failed in the metadata

2/ write '-blocked' to the rdev state to allow the kernel's failure
   mechanism to advance

3/ the kernel will take away the drive's role in remove_and_add_spares()

4/ once the disk no longer has a role writing 'remove' to the rdev state
   will get the disk out of array.

There is a window after writing '-blocked' where the kernel will return
-EBUSY to remove requests.  We rely on the fact that the disk will
continue to show faulty so we lazily wait until the kernel is ready to
remove the disk.  If the manager thread needs to get the disk out of the
way it can ping the monitor and wait, just like the replace_array()
case.

[buglet fix: swap the parameters of attr_match in read_dev_state]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:49 +10:00
Dan Williams 3dbccbcf5f keep member disk fd(s) for updates
From: Dan Williams <dan.j.williams@intel.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:46 +10:00
Dan Williams fd7cde1bf0 handle resync completion
From: Dan Williams <dan.j.williams@intel.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:42 +10:00
Neil Brown 549e9569c6 Merge mdmon 2008-05-15 16:48:37 +10:00
Dan Williams 5f2aace8eb Set 'metadata_version' for container_member in Incremental_container
From: Dan Williams <dan.j.williams@intel.com>

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:25 +10:00
Neil Brown 2f6079dc96 Create a container member
From: Neil Brown <neilb@suse.de>
2008-05-15 16:48:21 +10:00
Neil Brown 598f0d58ac Can now mostly assemble DDF arrays 2008-05-15 16:48:19 +10:00
Neil Brown a19c88b83d Start on --assemble support for DDF 2008-05-15 16:48:18 +10:00
Neil Brown 5f8097beb9 more ddf stuff
Create a BVD in a DDF

Do not actually assemble it yet...
2008-05-15 16:48:15 +10:00
Dan Williams a322f70c41 Initial DDF support code.
Create a ddf array by naming the device /dev/ddf* or
specifying metadata 'ddf'.

If ddf is specified with no level, assume a container (indeed,
anything else would be wrong).

**Need to use text_Version to set external metadata...

More ddf support

Load a ddf container.  Now
   --examine /dev/ddf
works.
super-ddf: fix compile warning

From: Dan Williams <dan.j.williams@intel.com>

super-ddf.c:723: format %lu expects type long unsigned int, but argument 3 has type unsigned int

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-05-15 16:48:14 +10:00
Iustin Pop 3dacb89029 Explain the read-balancing algorithm for RAID1 better in md.4
From: Iustin Pop <iusty@k1024.org>

There are many questions on the mailing list about the RAID1 read
performance profile. This patch adds a new paragraph to the RAID1
section in md.4 that details what kind of speed-up one should expect
from RAID1.

Signed-off-by: Iustin Pop <iusty@k1024.org>
2007-09-11 16:20:19 +02:00
Neil Brown 005debfc11 Fix problem with add a device to a 1.x array created with older mdadm.
When adding new disk to an array, don't reserve so much bitmap
space that the disk cannot store the required data. (Needed when
1.x array was created with older mdadm).
2007-08-20 14:14:25 +10:00