summaryrefslogtreecommitdiff
path: root/Incremental.c
Commit message (Collapse)AuthorAge
...
* Fix some compiler warnings.Luca Berra2011-06-17
| | | | | | Original by Luca, with various changes by Neil Signed-off-by: NeilBrown <neilb@suse.de>
* Incr: fix breakage in count_active.NeilBrown2011-06-15
| | | | | | | | | | If the second device is much newer than the first, but has a lower raid_disk number, we clear 'avail' badly and don't set up 'best' properly. Fix these things. Signed-off-by: NeilBrown <neilb@suse.de>
* getinfo_super now clears the 'info' structure before filling it in.NeilBrown2011-06-08
| | | | | | | | | | | | | | 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>
* Release 3.2.1NeilBrown2011-03-28
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: ping_monitor() usage causes memory leaksAdam Kwolek2011-03-18
| | | | | | | | | | When for ping_monitor() input devnum2devname() is used, received string pointer should be passed to free() for memory release. It is not made in several places. This use case should have function to avoid memory leak. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Run Grow_restart/Grow_continue when assembling the content of a container.NeilBrown2011-03-08
| | | | | | | | | | | | | As containers can now grow, we need to use both Grow_restart (to replay any backup-file) and Grow_continue when assembling the content of a container. Note that we don't pass a backup-file when doing incremental assembly. If such is needed in that case, the assembly will fail. To restart such arrays, explicit assembly is required. Signed-off-by: NeilBrown <neilb@suse.de>
* Continue reshape after assembling arrayAdam Kwolek2011-03-02
| | | | | | | | | | | | | | | | | assemble_container_content() cannot close mdfd handle, as it could be required by reshape continuation. mdfd handle is closed outside this function, when it is not longer necessary. Call to Grow_continue is added for reshape continuation after assembly. In the nearest future, simple condition: if (content->reshape_active) before Grow_continue() call will be replaced by check function for support container operation /reshape/. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Seg Fault in incremental if BBM log detectedKrzysztof Wojcik2011-02-18
| | | | | | | | | | | | Bug detected for imsm metadata. Assembling of array using Incremental switch generate segmentation fault if BBM log is detected. Reason: missing return from Incremental_container if BBM is detected and unnecessary list=NULL assignment. This patch fix the problem and memory leak in this area. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Various compile fixes.NeilBrown2011-02-01
| | | | | | | Make "make everything" succeed. This fixed some real bugs. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow domain_test to report that no domains were found.NeilBrown2011-02-01
| | | | | | | | | Sometime we will need to know the difference between no domains found and domains didn't match. So allow domain_test to return different values and fix up all callers to maintain current behaviour. Signed-off-by: NeilBrown <neilb@suse.de>
* Incr: don't exclude 'active' devices from auto inclusion in a container.NeilBrown2011-02-01
| | | | | | | | For containers, it is always appropriate to include a device in the container. Whether it should then be included in an array is a separate question. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: move suitable spares to container when subarrays started.Anna Czarnowska2011-01-05
| | | | | | | | | | | | | By default Incremental places all imsm spares in separate container with uuid=0:0:0:0. (patch giving spares uuid_zero needed) When we find enough members to start an array we are able to determine domain so we search spare container for suitable spares and move them to the container that is currently assembled. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Consider target only for spare-same-domainPrzemyslaw Czarnowski2010-12-26
| | | | | | | otherwise, matching target will force spare-same-domain regardless of action that comes in domain. Signed-off-by: NeilBrown <neilb@suse.de>
* Validate size of potential spare disk for external metadata (with containers)Przemyslaw Czarnowski2010-12-26
| | | | | | | | mdinfo read with sysfs_read do not contain information about the space needed to store data of all volumes created in that container, so that spare can be used as replacement for existing subarrays in the future. Signed-off-by: NeilBrown <neilb@suse.de>
* Skip domain check for spare-same-slotPrzemyslaw Czarnowski2010-12-26
| | | | | | | | If lost disk was the only one that belonged to particular domain, array won't match with that domain any longer. We can achieve this by moving domain check below the 'target' test. Signed-off-by: NeilBrown <neilb@suse.de>
* Added test for array degradation for spare-same-slotPrzemyslaw Czarnowski2010-12-26
| | | | | | | | | | spare-same-slot allows re-adding of missing array member with disk re-inserted into the same slot where previous member was plugged in. If in the meantime another spare has been used for recovery, same slot cookie should be ignored. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* external: get number of failed disks for containerPrzemyslaw Czarnowski2010-12-26
| | | | | | | | | Container degradation here is defined as the number of failed disks in mostly degraded sub-array. This number is used as value for array.failed_disks and used in comparison to find best match. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Bad block verification during assembling arrayKrzysztof Wojcik2010-12-26
| | | | | | | | | | | | | | | We need to refuse to assemble an arrays with bad blocks. Initially there was condition in container_content function that returns error value in the case when metadata store information about bad blocks. When the container_content function is called from functions NOT connected with assemble (Kill_subarray, Detail) we get faulty error return value. Patch introduces new flag in array.status - MD_SB_BBM_ERRORS. It is set in container_content when bad blocks are detected and can be checked by container_content caller. Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: incremental for bare disks returns invalid valuePrzemyslaw Czarnowski2010-12-21
| | | | | | | | return value should remain the same as result of Manage_Subdevs (last significant operation). Right now it is inverted what results in error status for successful operation. Signed-off-by: NeilBrown <neilb@suse.de>
* fix: adding spare via incremental do not trigger recoveryPrzemyslaw Czarnowski2010-12-21
| | | | | | | | After incremental has added spare, monitor should be woken up in order to see if anything has changed. If mdmon is not waken up, recovery do not start. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow --update=devicesize with --re-addNeilBrown2010-12-09
| | | | | | | | | | This is useful with 1.1 and 1.2 metadata to update the metadata if the device size has changed. The same functionality can be achieved by writing to the device size in sysfs after re-adding normally, but in some cases this might be easier. Signed-off-by: NeilBrown <neilb@suse.de>
* fix: incremental on invalid container causes segfaultHawrylewicz Czarnowski, Przemyslaw2010-12-07
| | | | | | | | | | counterpart of 417f346ee0 for incremental. If md device has metadata_version="none" super_by_fd() matches supertype=super0. Call of load_container() dereferences null, so we have to forbid it. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental - avoid including wayward devices.NeilBrown2010-11-29
| | | | | | | | | | | | | | | | | | | If a devices - typically in a mirrored set - is assembled independently of the other devices, and then attempted to be brought back into the set, it could contain inconsistent data. It should not be included. So detect this situation by ensuring that the 'most recent' device is believed to be active by every other device. If a device is wayward, it will only consider fellow wayward devices to be active and will think all others are failed or missing. This patches fixes --incremental, --assemble was done in an earlier patch. Signed-off-by: NeilBrown <neilb@suse.de>
* Incr: reduce the number of times we load data from sysfs.NeilBrown2010-11-25
| | | | | | | | | | Rather than calling sysfs_read whenever we want data from sysfs, call it once at the start will all the requests of interest, then just use that, Make sure we free it properly too. Signed-off-by: NeilBrown <neilb@suse.de>
* Add action=spare-same-slot policy.NeilBrown2010-11-22
| | | | | | | | | | | | | | | | | | | | | | When "mdadm -I" is given a device with no metadata, mdadm tries to add it as a 'spare' somewhere based on policy. This patch changes the behaviour in two ways: 1/ If the device is at a 'path' where a previous device was removed from an array or container, then we preferentially add the spare to that array or container. 2/ Previously only 'bare' devices were considered for adding as spares. Now if action=spare-same-slot is active, we will add non-bare devices, but *only* if the path was previously in use for some array, and the device will only be added to that array. Based on code From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* incr/spare: recheck allowed action for each metadata.NeilBrown2010-11-22
| | | | | | | | | The current act_spare tests only test if it is allowed for some metadata. As we check each array or partitioning type, we need to double-check that sparing is allowed for that array or partitioning type. Signed-off-by: NeilBrown <neilb@suse.de>
* Incr/spare: make sure failure to identify metadata if handled gracefully.NeilBrown2010-11-22
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Incr: fix up return value in try_spareNeilBrown2010-11-22
| | | | | | | We only want to try partition_try_spare if array_try_spare failed. If it succeeded, there is nothing more to try. Signed-off-by: NeilBrown <neilb@suse.de>
* Factor out is_bare test.NeilBrown2010-11-22
| | | | | | | | | | Instead of open coding (and using horrible gotos), make this a separate function. Also fix the check for end of device - SEEK_END doesn't work on block devices. Signed-off-by: NeilBrown <neilb@suse.de>
* extension of IncrementalRemove to store location (path-id) of removed devicePrzemyslaw Czarnowski2010-11-22
| | | | | | | | | | | | | | | | If the disk is taken out from its port this port information is lost. Only udev rule can provide us with this information, and then we have to store it somehow. This patch adds writing 'cookie' file in /dev/.mdadm/failed-slots directory in form of file named with value of f<path-id> containing the metadata type and uuid of the array (or container) that the device was a member of. The uuid is in exactly the same format as in the mapfile. FAILED_SLOTS_DIR constant has been added to hold the location of cookie files. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Teach IncrementalRemove about containers.NeilBrown2010-11-22
| | | | | | | When we -I -R a device in a container, we must first fail it from each member array before we can remove it from the container. Signed-off-by: NeilBrown <neilb@suse.de>
* added --path <path_id> to give the information on the 'path-id' of removed ↵Przemyslaw Czarnowski2010-11-22
| | | | | | | | | | | | | | | | device <path-id> allows to identify the port to which given device is plugged in. In case of hot-removal, udev can pass this information for future use (eg. write this name as 'cookie' allowing to detect the fact of reinserting device to the same port). --path <path-id> parameter has been added to device removal handle (and char *path has been added to IncrementalRemove() to pass this value) in order to pass path-id to this handler. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add must_be_container helper.NeilBrown2010-11-22
| | | | | | | This checks a block device to see if it could be a container, and in particular cannot be a member device. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve type names for mddev_devNeilBrown2010-11-22
| | | | | | | | | Remove the _t pointer typedef and remove the _s suffix for the structure, These things do not help readability. Signed-off-by: NeilBrown <neilb@suse.de>
* Improve mddev_ident type definitions.NeilBrown2010-11-22
| | | | | | | | Remove the _t typedef and remove the _s suffix from the struct name. These things do not help readability. Signed-off-by: NeilBrown <neilb@suse.de>
* Use load_container in Incremental assembly.NeilBrown2010-11-22
| | | | | | | | | 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>
* Incremental: Factor out search of mdstatNeilBrown2010-11-22
| | | | | | As we will soon use it in two places. Signed-off-by: NeilBrown <neilb@suse.de>
* Make Incremental_container staticNeilBrown2010-11-22
| | | | | | as it is only used in Incremental.c Signed-off-by: NeilBrown <neilb@suse.de>
* Add subarray arg to container_content.NeilBrown2010-11-22
| | | | | | | | | | 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>
* Incremental - fix small bug in count_active.NeilBrown2010-11-22
| | | | | | | | If the first device found has a much smaller event count than a subsequent device, that device will not be entered in the 'avail' array properly. Signed-off-by: NeilBrown <neilb@suse.de>
* get_info_super: report which other devices are thought to be working/failed.NeilBrown2010-11-22
| | | | | | | | | | | | | | 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>
* Convert 'auto' config line to policy statementsNeilBrown2010-09-06
|
* Add support for auto-partitioning base devices.NeilBrown2010-09-06
| | | | | | | | If a device is bare and policy suggests that it can be used as a spare for virtual 'partitions' array, find an appropriate partition table and write it to the device. Signed-off-by: NeilBrown <neilb@suse.de>
* First steps to supporting auto-spare-add to groups of partitioned devices.NeilBrown2010-09-06
| | | | | | | | | Adding a spare to a group of partitioned devices is quite different from adding one to an array. So detect which option is worth trying based on policy and then try one or the other - or possibly both - as appropriate. Signed-off-by: NeilBrown <neilb@suse.de>
* Add mbr pseudo metadata handler.NeilBrown2010-09-06
| | | | | | | | | | | | To support incorpating a new bare device into a collection of arrays - one partition each - mdadm needs a modest understanding of partition tables. The main needs to be able to recognise a partition table on one device and copy it onto another. This will be done using pseudo metadata types 'mbr' and 'gpt'. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow --incremental to add a device as a spare if policy allows.NeilBrown2010-09-06
| | | | | | | | If policy allows act_spare or act_force_spare, -I will add a bare device as a spare to an appropriate array. We don't support adding non-bare devices as spares yet. Signed-off-by: NeilBrown <neilb@suse.de>
* Use action policy to keep recently-disconnected devices in the array.NeilBrown2010-09-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we find a device that was recently part of the array but is now out of date (based on the event count) we might want to add it back in (like --re-add) if the likely cause was a connection problem or we might not if the likely cause was device failure. So make this a policy issue: if action=re-add or better, try to re-add any device that looks like it might be part of the array. This applies: when we assemble the array: old devices will be evicted by the kernel and need to be re-added. when we assemble the array during --incr for the same reason. when we find a device that could be added to a running array. This doesn't affect arrays with external metadata at all. For such arrays: When the container is assembled, the most recent instance of each device is included without reference to whether it is too old or not. Then the metadata handler must which slices of which devices to include in which array and with what state. So the ->container_content should probably check the policy and compare the sequence numbers/event counts. When a device is added (--add) to a container with active arrays we only add as a 'spare'. --re-add doesn't seem to be an option. When a device is added with -I ->container_content gets another chance to assess things again. So again it should check the policy. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce single-exit pattern for IncrementalNeilBrown2010-09-06
| | | | | | All exits should goto the end for clean-up. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow --incremental to add spares to an array.NeilBrown2010-08-12
| | | | | | | | | | | | | | Commit 3a6ec29ad56 stopped us from adding apparently-working devices to an active array with --incremental as there is a good chance that they are actually old/failed devices. Unfortunately it also stopped spares from being added to an active array, which is wrong. This patch refines the test to be more careful. Reported-by: <fibreraid@gmail.com> Analysed-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: return success in 'container not enough' caseDan Williams2010-08-10
| | | | | | | | | Commit 97b4d0e9 "Incremental: honor an 'enough' flag from external handlers" introduced a regression in that it changed the error return code for successful invocations. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com>