summaryrefslogtreecommitdiff
path: root/Incremental.c
Commit message (Collapse)AuthorAge
* Minor cosmetic fixes in various files.NeilBrown2012-08-13
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change Incremental and related functions to take struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow arrays to be assembled read-only.NeilBrown2012-07-09
| | | | | | The option was there, but never used. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove re_add flag in favour of new disposition.NeilBrown2012-07-09
| | | | | | | | | | | Instead of disposition == 'a' re_add == 1 use disposition == 'A' to record that a re-add was requested. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: fix adding devices with --incrementalNeilBrown2012-03-22
| | | | | | | | | | | | We should use 'info' here, not 'info2'. info2 refers to some other device (There may not even be one).l info is *this* disk. This is particularly important for getting info.disk.state correct, which the kernel depends on to get 're-add' functionality correct. Signed-off-by: NeilBrown <neilb@suse.de>
* avoid double-free upon "old buggy kernel" sysfs_read failureJim Meyering2012-02-22
| | | | | | | | | * Incremental.c (Incremental): On sysfs_read failure, don't call sysfs_free(sra) just before "goto out_unlock", since that very same "sra" is freed the same way by the clean-up code below. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Remove avail_disks arg from 'enough'.NeilBrown2012-02-07
| | | | | | | | It can easily be calculated from 'avail' and 'raid_disks', and we will soon have a case where we don't have it easily available to pass in. Signed-off-by: NeilBrown <neilb@suse.de>
* fix: container creation with --incremental used.Lukasz Dorau2012-01-12
| | | | | | | | | | | If there is no name provided for a container by the metadata it is always appropriate to use the metadata version name. create_mddev will still add a uniquifying digit to the end so there is little risk of confusion. This makes the --incremental code behave the same as the --assemble code. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: make some plurals conditional.NeilBrown2011-12-23
| | | | | | "1 devices" is ugly. Fix it. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: make sure container name appears in /devNeilBrown2011-12-23
| | | | | | | | | | | | | | | | | We need to send a "change" event just like we do when creating an array. This reverts commit 382afe49b10cf3e5a4764cee74649d1cd8c91813 The problem is that we need udev to create the file in /dev for us. It might be unnecessary for udev to consider assembling things in this array, but it shouldn't cause a problem. If it did that would be a different bug which we probably need locking to fix. Or maybe udev shouldn't trigger a "-I" for containers appearing. Signed-off-by: NeilBrown <neilb@suse.de>
* array_try_spare(): open_dev() returns -1 on error, not zeroJes Sorensen2011-11-03
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IncrementalScan(): Fix memory leakJes Sorensen2011-11-02
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental(): Check return value of dev_open() before trying to use itJes Sorensen2011-11-02
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: Fix a merge error in recent patchNeilBrown2011-11-01
| | | | | | | | | commit 81219e70f2a9be7292046860ea15528fe5854cab required merging and I messed it up. The locking shouldn't be there - the caller locks now. Reported-by: "Labun, Marcin" <Marcin.Labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* partition_try_spare() use closedir() to release DIR * returned by opendir()Jes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix memory leak of 'st3' in array_try_spare()Jes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Remove duplicated code: search_mdstat and conf_matchNeilBrown2011-11-01
| | | | | | | | | search_mdstat and conf_match are almost identical. Put all the functionality in conf_match, and remove search_mdstat. Reported-by: Jes.Sorensen@redhat.com Signed-off-by: NeilBrown <neilb@suse.de>
* kill-subarray: fix, IMSM cannot kill-subarray with unsupported metadataLabun, Marcin2011-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | container_content retrieves volume information from disks in the container. For unsupported volumes the function was not returning mdinfo. When all volumes were unsupported the function was returning NULL pointer to block actions on the volumes. Therefore, such volumes were not activated in Incremental and Assembly. As side effect they also could not be deleted using kill-subarray since "kill" function requires to obtain a valid mdinfo from container_content. This patch fixes the kill-subarray problem by allowing to obtain mdinfo of all volumes types including unsupported and introducing new array.status flags. There are following changes: 1. Added MD_SB_BLOCK_VOLUME for blocking an array, other arrays in the container can be activated. 2. Added MD_SB_BLOCK_CONTAINER_RESHAPE block container wide reshapes (like changing disk numbers in arrays). 3. IMSM container_content handler is to load mdinfo for all volumes and set both blocking flags in array.state field in mdinfo of unsupported volumes. In case of some errors, all volumes can be affected. Only blocked array is not activated (also reshaped as result). The container wide reshapes are also blocked since by metadata definition they require modifications of both arrays. 4. Incremental_container and Assemble functions check array.state and do not activate volumes with blocking bits set. 5. assemble_container_content is changed to check container wide reshapes before activating reshapes of assembled containers. 6. Grow_reshape and Grow_continue_command checks blocking bits before starting reshapes or continueing (-G --continue) reshapes. 7. kill-subarray ignores array.state info and can remove requested array. Signed-off-by: Marcin Labun <marcin.labun@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental() lock error handlingJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* array_try_spare(): missing map_unlock()Jes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't tell sysfs to launch the container as we are doing it ourselvesJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Remove race for starting container devices.Jes Sorensen2011-10-22
| | | | | | | | | | | | | | This moves the lock handling out of Incremental_container() and relies on the caller holding the lock. This prevents conflict with a follow-on mdadm comment which may try and launch the device in parallel. This involves replacing a call to "Incremental" with an unrolled version with just the case that calls Incremental_container and so needs a call to ->load_container. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Do not continue reshape during initrd phaseAdam Kwolek2011-10-03
| | | | | | | | | | | | | | During initrd phase continuing reshape will cause file system context lost. This blocks ability to control reshape using checkpoints. To avoid this, during initrd phase assemble has to be executed with '--freeze-reshape' option. This causes that mdadm restores reshape critical section only. Reshape can be continued later after system full boot. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: correct unlocking of map fileLukasz Dorau2011-10-03
| | | | | | | | 1. Three missing map_unlock() calls were added. 2. Map file must be unlocked on fork, else child will hold lock. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Discourage large devices from being added to 0.90 arrays.NeilBrown2011-09-08
| | | | | | | | 0.90 arrays can only use up to 4TB per device. So when a larger device is added, complain a bit. Still allow it if --force is given as there could be a valid use. Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Prevent using null list pointerNeilBrown2011-09-07
| | | | | | | | | When not all attributes are supported (attributes incompatibility) function container_content_imsm returns NULL pointer. We need to cope with a NULL list better. Reported-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* 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>