summaryrefslogtreecommitdiffstats
path: root/super-intel.c
Commit message (Collapse)AuthorAgeFilesLines
* powerpc compile fixDoug Ledford2010-04-071-1/+1
| | | | | Signed-off-by: Doug Ledford <dledford@redhat.com> 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>
* Merge branch 'master' of git://github.com/djbw/mdadmNeilBrown2010-03-101-10/+5
|\
| * imsm: kill ->creating_imsm flagDan Williams2010-03-031-6/+4
| | | | | | | | | | | | It is an unused holdover from long since removed functionality. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Revert "Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers."Dan Williams2010-03-031-4/+1
| | | | | | | | | | | | | | This reverts commit 9ef5dbff4adc7979102e71efe8efd83d8e0dc775 as it is duplicating the check that is done internal to imsm_read_serial(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | 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>
* 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>
* super-intel.c: use %zu specifier for printf of size_tLuca Berra2010-02-011-1/+1
| | | | | | | | Fix compile warning when size_t is not a long. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Luca Berra <bluca@vodka.it> Signed-off-by: NeilBrown <neilb@suse.de>
* Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers.Doug Ledford2010-01-191-1/+4
| | | | | | | | This allows a person to testing using loopback devices that don't support serial number queries. Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'klockwork' of git://github.com/djbw/mdadmNeilBrown2009-12-301-34/+46
|\ | | | | | | | | Conflicts: super-intel.c
| * imsm: prune dead code in validate_geometry_imsmDan Williams2009-12-101-15/+0
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix required to enable RAID arrays on SAS disks.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The patch increases the capacity of buffers used to store sysfs path names. Originally the buffers were too small to hold the canonical representation of sysfs path (in case of a SAS device, especially a device installed behind an expander). Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Reviewed-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-0/+2
| | | | | | | | | | | | | | | | Possible memory leak. Dynamic memory stored in 'dev' and 'dev' allocated through function 'malloc' can be lost on exit path. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-3/+5
| | | | | | | | | | | | | | | | | | Possible memory leak. Dynamic memory stored in 'sra' allocated through function 'sysfs_read' at line 2484 can be lost at lines 2491, 2560 and 2571. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory leak defect.Artur Wojcik2009-12-101-3/+6
| | | | | | | | | | | | | | | | Dynamic memory stored in 'devnum2devname(st->container_dev)' allocated through function 'devnum2devname' at line 1274 is lost at line 1278. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-0/+6
| | | | | | | | | | | | | | | | Pointer 'c' returned from call to function 'strchr' at line 954 may be NULL and will be dereferenced at line 955. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | | | Pointer 'disk' returned from call to function '_get_imsm_disk' at line 700 may be NULL and will be dereferenced at line 710. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference defect.Artur Wojcik2009-12-101-0/+2
| | | | | | | | | | | | | | | | Pointer 'st' returned from call to function 'malloc' at line 320 may be NULL and it will be dereferenced at line 321. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * imsm: no need to report the component device name from container_contentDan Williams2009-12-101-2/+0
| | | | | | | | | | | | | | | | sysfs_add_disk() regenerates the name from major:minor, so we can drop a strcpy that the static analysis checker does not like. Reported-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for buffer overflow defect.Artur Wojcik2009-12-101-1/+1
| | | | | | | | | | | | | | Buffer overflow, array index of 'nm' may be out of bounds. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference.Artur Wojcik2009-12-101-0/+4
| | | | | | | | | | | | | | | | | | Pointers '_dev' and '_disk' returned from call to function '_get_imsm_dev' and '_get_imsm_disk' may be NULL and will be dereferenced at lines 2933 and 2934, respectively. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for NULL pointer dereference.Artur Wojcik2009-12-101-1/+2
| | | | | | | | | | | | | | | | Suspicious dereference of pointer 'super' before NULL check at line 3429. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for memory and resource leak.Artur Wojcik2009-12-101-7/+12
| | | | | | | | | | | | | | | | | | Make sure opened file descriptor is cleaned up on exit path. Also make sure allocated memory for 'sra' is released on exit path, too. Signed-off-by: Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
| * Fix for possible NULL pointer dereference.Artur Wojcik2009-12-101-1/+6
| | | | | | | | | | | | | | | | Pointer 'this' returned from call to function 'malloc' at line 3795 may be NULL and will be dereferenced at line 3796. Artur Wojcik <artur.wojcik@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | imsm: add support for checkpointing via 'curr_migr_unit'Dan Williams2009-12-211-32/+288
| | | | | | | | | | | | | | | | Unlike native md checkpointing some data about the geometry and type of the migration process is coded into curr_migr_unit. Provide logic to convert between md/{resync_start|recovery_start} and imsm/curr_migr_unit. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | 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-4/+4
| | | | | | | | | | | | | | 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-5/+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>
* | imsm: cleanup print_imsm_dev()Dan Williams2009-12-121-9/+10
| | | | | | | | | | | | | | When printing the migration state there is no need to print "migrating". The fact that the state is non-idle should be enough indication. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | imsm: fix thunderdome segfaultDan Williams2009-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | disk_list_get() can return NULL if: 1/ A formerly missing disk is re-added 2/ The original array has not been rebuilt, so the family number of the missing disk still matches 3/ The metadata record of the in-sync disks are read before the missing disk This will result in the missing disk not adding its own serial number to the disk_list, only its truncated value will be present. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | imsm: fix spare promotionDan Williams2009-12-101-0/+1
| | | | | | | | | | | | | | When associating a spare take on the target's metadata version number to satisfy future compare_super checks. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | imsm: honor orom constraints for auto-layoutDan Williams2009-12-101-19/+33
| | | | | | | | | | | | | | | | Factor out the orom checking bits to validate_geometry_imsm_orom() and share it between validate_geometry_imsm_volume() and the entry path to reserve_space(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | imsm: catch attempt to auto-layout zero-length arraysDan Williams2009-12-011-9/+12
|/ | | | | | | | | | When -z is omitted reserve_space() looks to satisfy a zero length allocation which lo and behold is equal to the amount of free space on a full disk. So, catch maxsize == 0 and simplify the return value from merge_extents() to always equal amount of free space (no benefit to having a special case ~0ULL == error). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Improve error messages when metadata handler does not support request.NeilBrown2009-11-171-1/+4
| | | | | | | | | ->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>
* super-intel: Fix compilation of mdassemble.NeilBrown2009-10-201-1/+7
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: add --update=uuid supportDan Williams2009-10-131-12/+39
| | | | | | | | | | | | | | | When disks have conflicting container memberships (same container ids but incompatible member arrays) --update=uuid can be used to move offenders to a new container id by changing 'orig_family_num'. Note that this only supports random updates of the uuid as the actual uuid is synthesized. We also need to communicate the new 'orig_family_num' value to all disks involved in the update. A new field 'update_private' is added to struct mdinfo to allow this information to be transmitted. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix/support --updateDan Williams2009-10-131-28/+26
| | | | | | | | | | | Fix init_super_imsm() to return an empty mpb when info == NULL, and teach store_super_imsm() to simply write out the passed in mpb. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=523320 Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix spare record writeout raceDan Williams2009-10-131-24/+35
| | | | | | | | | | | | | | | imsm_activate_spare() in the manager thread may race against write_super_imsm_spares() in the monitor thread. Give write_super_imsm_spares() its own private mpb buffer to prevent confusing the manager. This change uncovered cases where spares were not being assembled due to a failed metadata version number check. Spares can freely associate across metadata version number, so reduce the scope of the version check in the spare assembly case. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: disambiguate family_numDan Williams2009-09-301-132/+448
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a result of trawling through the Windows implementation to learn the mechanism of how it disambiguates family_num. It is a continuation of commit 148acb7b "imsm: fix family number handling" which introduced a regression when reassembling a container with stale disks and rebuilt members. When rebuilding, a new family number is assigned to protect against the "prodigal array member" problem. It prevents a former family member from returning to the system and causing a rebuild to go the wrong direction. However, this invalidates looking at the generation number to determine the most up-to-date disk when comparing across family numbers. Instead the assembly logic looks for agreement between a disk's local family membership compared against a global list of all families in the system. Whenever a disk's local metadata does not match a family number on the global list that family number is marked offline. It is possible that this logic results in multiple incompatible but valid family numbers existing in a container. In this case mdadm.conf cannot be consulted because it only records the uuid which is generated from static fields in the metadata. The metadata lacks the data needed to disambiguate "local" versus "foreign". The "foreign" array in this case requires updating to change its container-id information (orig_family_num), and possibly the member array names. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: kill close() of component deviceDan Williams2009-09-301-3/+1
| | | | | | | | None of the other formats close the passed in fd at load, and this becomes a problem when trying to support --update where we need O_EXCL protection across the entire operation. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: cleanup disk status testsDan Williams2009-09-281-24/+29
| | | | | | | Add is_failed(), is_configured(), and is_spare() helpers to clean up disk status flag testing. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: clear CONFIGURED_DISK for failed drivesDan Williams2009-09-151-0/+1
| | | | | | | Synchronizing with what the Windows driver does. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: kill USABLE_DISK flagDan Williams2009-09-151-8/+4
| | | | | | | | | 'USABLE_DISK' is not a 'persistent' status flag it is an internal status flag used for the in memory representation of the disk in the Windows driver. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix spare promotionDan Williams2009-09-151-4/+3
| | | | | | | | 1/ Fix an off by one error when detecting whether the device allocation loop succeeded or not 2/ Update ->num_raid_devs before copying to avoid a segmentation fault Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Exmaine/brief: put member arrays after container arrays.NeilBrown2009-08-071-3/+18
| | | | | | | | | 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 spare-uuid assignmentDan Williams2009-07-311-1/+5
| | | | | | | | | | imsm spares do not have container membership by default so we associate them with the first container found in the configuration file. Some ARRAY lines do not specify the metadata type so we cannot assume that _cst will always be valid. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix family number handlingDan Williams2009-07-311-5/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* imsm: fix activate_spare off-by-oneDan Williams2009-07-311-9/+6
| | | | | | | | | The last sector of an array is calculated by start + size - 1. Reported-by: Rafal Marszewski <rafal.marszewski@intel.com> Reported-by: Jarema Bielanski <jarema.bielanski@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-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* imsm: fixup examine_brief to be more descriptive in the container only caseDan Williams2009-07-311-1/+3
| | | | | | | | | | | | | | | Prior to creating any arrays in a new container the output from -Ebs for a 4-disk imsm array returns: spares=4 We should at least display that these are imsm spares: ARRAY metadata=imsm spares=4 Signed-off-by: Dan Williams <dan.j.williams@intel.com>