summaryrefslogtreecommitdiffstats
path: root/super-ddf.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'fixes' into for-neilDan Williams2010-07-011-7/+2
|\
| * Always assume SKIP_GONE_DEVS behaviour and kill the flagDan Williams2010-06-161-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...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>
| * Incremental: honor an 'enough' flag from external handlersDan Williams2010-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Kill subarray v2Dan Williams2010-06-151-3/+22
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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>
* IMSM/DDF: don't recognised these metadata on partitions.NeilBrown2010-04-291-0/+4
| | | | | | | | | | | 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>
* ddf/intel: zero out old metadata before creating a container.NeilBrown2010-03-101-1/+5
| | | | | | | | 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>
* Make sure reshape_active is cleared by getinfo_superNeilBrown2010-03-091-0/+1
| | | | | | There were cases where --detail would report phantom reshapes. Signed-off-by: NeilBrown <neilb@suse.de>
* config: add 'homehost' option to 'AUTO' line.NeilBrown2010-03-031-1/+5
| | | | | | 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>
* Assemble: fix --force assembly of v1.x arrays which are recovering.NeilBrown2010-02-041-0/+2
| | | | | | | | | | | | | | | | 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>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2009-12-301-6/+8
|\
| * Teach sysfs_add_disk() callers to use ->recovery_start versus 'insync' parameterDan Williams2009-12-211-0/+2
| | | | | | | | | | | | Also fixup 'in_sync' versus 'insync' typo. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Introduce MaxSectorDan Williams2009-12-211-2/+2
| | | | | | | | | | | | | | 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>
| * mdmon: cleanup resync_startDan Williams2009-12-141-4/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | DDF: fix incorrect header magic number.NeilBrown2009-12-301-1/+1
|/ | | | | I was using the wrong magic number when creating an array. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve error messages when metadata handler does not support request.NeilBrown2009-11-171-3/+10
| | | | | | | | | ->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>
* Assemble: include ACTIVE but not in-sync devices as non-spares.NeilBrown2009-11-171-1/+1
| | | | | | | | | 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>
* ddf: prevent superblock being zeroed on --updateDan Williams2009-10-131-8/+19
| | | | | | | | | | 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>
* Exmaine/brief: put member arrays after container arrays.NeilBrown2009-08-071-1/+13
| | | | | | | | | 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>
* imsm: fix family number handlingDan Williams2009-07-311-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* conditionally update uuids in the map file after Create()Dan Williams2009-07-311-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* fix examine_brief segfaultDan Williams2009-07-311-0/+5
| | | | | | | | | | | | | | 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>
* teach imsm and ddf what st->subarray means at load_super timeDan Williams2009-07-311-0/+12
| | | | | | | | | | | | | 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>
* Examine: fix --examine --brief --verbose on containers.NeilBrown2009-06-041-1/+1
| | | | | | | | | | | 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>
* Update copyright dates and remove references to @cse.unsw.edu.auNeilBrown2009-06-021-1/+1
| | | | | | Also removed 'paper' addresses. Signed-off-by: NeilBrown <neilb@suse.de>
* Make --brief even briefer.NeilBrown2009-05-111-1/+1
| | | | | | | | | | | | | 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>
* Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0NeilBrown2009-04-141-0/+1
|\ | | | | | | | | | | | | | | | | Conflicts: Grow.c mdadm.h sysfs.c Due to independent fixes for the "mdadm hangs if reshape finishes too quickly" problem.
| * imsm: set array size at Create/AssembleDan Williams2009-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | super-ddf: fix compile warnings on ppc64Doug Ledford2009-04-081-3/+4
| | | | | | | | | | | | | | | | 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>
* | ddf: fixed 'working_disks' reported by container_content.NeilBrown2009-04-071-2/+2
| | | | | | | | | | | | | | | | 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>
* | ddf: improve print out of physical devices.NeilBrown2009-04-071-4/+4
| | | | | | | | | | | | Just add some more space really. Signed-off-by: NeilBrown <neilb@suse.de>
* | ddf: fix variable name overloadNeilBrown2009-04-071-4/+5
| | | | | | | | | | | | | | | | 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>
* | ddf: make sure Create fails if devices are too small.NeilBrown2009-04-021-0/+2
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
* | ddf: fix bug with error returns.NeilBrown2009-04-021-6/+4
|/ | | | | | | | 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>
* mdmon: allow incremental assembly of containers.NeilBrown2009-03-101-0/+1
| | | | | | | | 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>
* DDF: fix up container_contentNeilBrown2009-03-101-3/+4
| | | | | | | 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>
* ddf: use better random number generation.NeilBrown2009-03-101-8/+15
| | | | | | use /dev/urandom rather than calls to 'random()' if possible. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: add examine_export for ddf and avoid crashes.NeilBrown2009-03-091-0/+13
| | | | | | If the personality doesn't provide export_examine_super, don't crash. Signed-off-by: NeilBrown <neilb@suse.de>
* ddf: fix memory corruption bug.NeilBrown2009-03-091-1/+1
| | | | | When adding to a point, you don't need to multiple by the size of the pointer - C does that for you!
* DDF: minor formatting improvementNeilBrown2009-03-091-1/+1
| | | | avoid long lines in --examine output
* Support new raid6 layouts needed for DDFNeilBrown2009-03-091-8/+31
| | | | | | | | 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>
* sysfs: allow sysfs_read to detect and drop removed disksDan Williams2009-02-241-1/+7
| | | | | | | | | | | | | | | 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>
* Merge branch 'devel' of ↵NeilBrown2008-12-181-0/+1
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0
| * introduce --detail-platform to display platform raid capabilitiesDan Williams2008-12-081-0/+1
| | | | | | | | | | | | | | 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>
* | DDF: improve --examine outputNeilBrown2008-12-041-19/+38
| | | | | | | | | | | | | | 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>
* | Create: support autolayout when creating in a DDFNeilBrown2008-12-041-16/+140
|/ | | | | | | | | 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>
* allow add_to_super to return errorsDan Williams2008-11-271-3/+5
| | | | | | Prepare add_to_super to validate disks against the platform capabilities Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* ddf: store homehost information to allow smooth assembly.NeilBrown2008-11-041-0/+2
| | | | | | | 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>
* DDF: report member arrays in examine_brief.NeilBrown2008-11-041-10/+26
| | | | | | Thus an auto-generated config file will list all the arrays. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix irregularities with retrieval of 'name' from metadata.NeilBrown2008-11-041-3/+12
| | | | | | It is only 16 bytes, not 32. And is space padded, not nul terminated. Signed-off-by: NeilBrown <neilb@suse.de>
* Don't give array name in --examine --brief output if it is doubtful.NeilBrown2008-11-041-1/+1
| | | | | Now that mdadm.conf doesn't need an array name, we don't need to give one if the array cannot reliably provide one.