summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Avoid memory leakJes Sorensen2011-11-01
| | | | | | | | In case of second posix_memalign() failing, release memory allocated in first posix_memalign() call. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add missing return in case of trying to grow sub-arrayJes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix memory leakJes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.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>
* Fix memory leakJes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix memory leakJes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix memory leaks in reshape_array()Jes Sorensen2011-11-01
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Kill: remove duplicate tests on 'force'.NeilBrown2011-11-01
| | | | | | | | | | | | We test 'force' twice with the second having not chance of taking effect. As a result a subsequent message - intended for use in the 'force' case is never generated. So remove the first test - it is unnecessary. Reported-by: 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>
* Avoid stack overflow if GPT partition entries on disk are > 128 bytesJes Sorensen2011-10-31
| | | | | | | | | | | Per [1] GPT partition table entries are not guaranteed to be 128 bytes, in which case read() straight into a struct GPT_part_entry would result in a buffer overflow corrupting the stack. [1] http://en.wikipedia.org/wiki/GUID_Partition_Table Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Close unused handle in child process during reshape restartAdam Kwolek2011-10-27
| | | | | | | | | | | | | | | | | | | | When array reshape (e.g. raid0->raid5 migration) is restarted during array assembly, file system placed on this array cannot be mounted until reshape is finished due to "busy" error. This is caused when reshape is executed on array for external metadata and array handle is cloned /forked/ to child process environment but not closed. Handle can't be closed before executing Grow_continue() because it is used later in code. Close unused handle in child process /reshape_container()/. It is similar to close fd handle in reshape_array() before calling manage_reshape()/child_monitor() in Grow.c:2290. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* GCC compile fix: remove calculation of unused variable 'reservation'Jes Sorensen2011-10-27
| | | | | | | | gcc 4.6.1 doesn't like calculating a variable that then isn't used. Remove it. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* util.c: two typos fixedLukasz Dorau2011-10-26
| | | | | | | Two typos fixed. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: Fixes metadata after migration from Raid 0 to Raid 10root2011-10-22
| | | | | | | | | | | | After migration from Raid 0 to Raid 10, the metadata is incorrect, leaving one mirror disk marked as spare and one missing disk as a member of the array. The reason is that the metadata update code for spare activation procedure takes into account one spare disk only, not checking the following ones. Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Moves metadata update code for spare activation to separate functionLukasz Orlowski2011-10-22
| | | | | | | | | The metadata update code during spare activation is moved to a separate function for clarity of code, as a prework for the next patch fixing the bug. Signed-off-by: Lukasz Orlowski <lukasz.orlowski@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>
* Create() check malloc() return valueJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create() don't leave the lock hanging on errorJes 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>
* Hold the map lock while performing Assemble to avoid races with udevJes 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>
* super0: fix overflow when checking max size.NeilBrown2011-10-20
| | | | | | | We need to force multiplication to use ULL before they get to big, else it overflows. So move the "2ULL" to the start. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: correct debug printing of the volume's nameLukasz Dorau2011-10-20
| | | | | | | | | | | The volume's name is saved in the array of chars. All elements of the array can have nonzero values and the next byte in memory does not have to have the value of 0, so one must be cautious when printing out the volume's name. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: prevent segfault in mark_failureLukasz Dorau2011-10-20
| | | | | | | | | | Using an array of chars without the terminating null byte as a parameter of sprintf() function causes segfault when dealing with SAS drives (with 20-digits serial number). The memcpy() function is used instead. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: Only ping monitor on level change if array is container based.NeilBrown2011-10-17
| | | | | | | | Pinging the monitor for a NULL container is bad. Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Tested-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix unterminated buffer after readlink() callThomas Jarosch2011-10-17
| | | | | Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix off-by-one in readlink() buffer size handlingThomas Jarosch2011-10-17
| | | | | | | | | | | | | | readlink() returns the number of bytes in the buffer. If we do something like len = readlink(path, buf, sizeof(buf)); buf[len] = '\0'; we might write one byte past the end of the buffer. Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: stopped resync does not continue after auto-assemblationLukasz Dorau2011-10-10
| | | | | | | | Resync stopped with "mdadm -Ss" command does not continue after issuing "mdadm -As" command. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Always run Grow_continue() for started array.Adam Kwolek2011-10-07
| | | | | | | | | | | | | | So far there were 2 reshape continuation cases: 1. array is started /e.g. reshape was already invoked during initrd start-up stage using "--freeze-reshape" option/ 2. array is not started yet /"normal" assembling array under reshape case/ This patch narrows continuation cases in to single one. To do this array should be started /set readonly in to array_state/ before calling Grow_continue() function. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: always use set_migr_type to set type of migrationPrzemyslaw Czarnowski2011-10-06
| | | | | | | | | | | | For 'resync' besides the update of migration type (imsm_vol.migr_type structure) additionally status (imsm_dev.status) flag is set to DEV_VERIFY_AND_FIX. In order to clean up after migration, status flag must be cleared. For this reason, migration type shouldn't be set directly but via set_migr_type(). Otherwise status does not reflect the state of array. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix handling for "auto" line in mdadm.confNeilBrown2011-10-06
| | | | | | | | | | | | | Two problems. 1/ pol_merge was ignoring the pol_auto tag so any 'auto' information was lost 2/ If a device had not path (e.g. loop devices) or if there were no path-based policies, we didn't bother looking for policy at all. So path-independant policies were ignored. Reported-by: Christian Boltz <suse-beta@cboltz.de> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: correct adding and activation of spare disksLukasz Dorau2011-10-05
| | | | | | | | | | | | | | | During activation of spare disks, only one of all available spare disks can be activated at this moment. It causes that for example during take-over from RAID0 with 2 disks to RAID10, only one of two spare disks is taken for recovery and a degraded RAID10 array with only 3 of 4 working disks is created. It has been fixed by adding more than one of all available spare disks and saving them in additional_test_list which is passed to imsm_add_spare(). Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Set correct reshape restart positionAdam Kwolek2011-10-05
| | | | | | | | | | | | | | | | This patch version is simplified compared to previous one. There is no use of freeze_reshape flag in start_reshape(). It is assumed that for reshape starting condition reshape_progress field contains 0 value /correct start position/. For reshape restart case, it contains correct restart position. This approach doesn't make start_reshape() difficult to read/manage and /imho/ kernel changes to change mdstat reporting behavior are not necessary. Setting correct position allows user to see it in the mdstat during reshape restart and reshape process is not reported as resync. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor reshaped arrayAdam Kwolek2011-10-05
| | | | | | | | | Reshape can be run for monitored arrays only /external metadata case/. Before reshape can be executed, make sure that just starter array/container is monitored. If not, run mdmon for it. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Remove freeze() call from Grow_continue()Adam Kwolek2011-10-05
| | | | | | | | | | Grow_continue() for external metadata should be executed on blocked from monitoring array(s)/container. Additional call to freeze() is not necessary in such case. It produces meaningless error message only. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Fill recovery_blocked field present in mdinfoAdam Kwolek2011-10-05
| | | | | | | If any reshape in container is active set recovery_blocked field. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add recovery blocked field to mdinfoAdam Kwolek2011-10-05
| | | | | | | | | | | | | | | | | | | When container is assembled while reshape is active on one of its member whole container can be required to be blocked from monitoring. For such purpose field recovery blocked is added to mdinfo structure. When metadata handler finds active reshape in container it should set recovery_blocked field to disable whole container monitoring during reshape. For arrays that doesn't use containers, recovery_blocked field has the same value as reshape_active field e.g. super0/1. In fact,recovery is blocked during reshape for such arrays. For ddf, metadata handler doesn't set reshape_active field, so recovery_blocked is not set also. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* restore_backup() throws core dumpNeilBrown2011-10-05
| | | | | | | | | restore_backup() throws core dump during releasing fdlist. Loop for closing handlers checks next_spare variable, but iterates disk_count. Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Move code to check_mdmon_version() functionAdam Kwolek2011-10-03
| | | | | | | Move code to function for code reuse. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Do not mark resync during reshapeAdam Kwolek2011-10-03
| | | | | | | | | | | | | During reshape, resync/rebuild in the same container is not possible due to fact that all arrays in container has to share the same disks set. Block new resync/rebuild process initialization and setting resync_start to 0 while any reshape in container is active. This avoids breaking container reshape and doesn't allow for starting multiple processes /resync/rebuild and reshape/ at the same time in md. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Do not allow for spare disk activation during reshapeAdam Kwolek2011-10-03
| | | | | | | | | | | | | | Spare disk activation or starting repair for one array while on second reshape is in progress, will lead to IMSM incompatible situation when 2 arrays in container shares different disks sets. This can cause that 2 processes in container /reshape and rebuild/ are in progress in parallel. This is IMSM incompatible situation also. Block spare disk activation and starting resync if any reshape in container is in progress. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Manual update for --continue optionAdam Kwolek2011-10-03
| | | | | | | | | | | | | | | | | | | | Patch adds to mdadm man the following information: --continue This option is complementary pair to assembly --freeze-reshape option. It is needed when --grow operation is interrupted and it is not restarted automatically due to --freeze-reshape usage during array assembly. Option --continue has to be used together with -G , ( --grow ) command and device that it should be executed on. All parameters required for reshape continuation will be read from array metadata. If initial --grow command had required --backup-file= option to be set, continuation option will require to have exactly the same backup file pointed to also. Any other parameter passed together with --continue option will be ignored. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Manual update for --continue optionAdam Kwolek2011-10-03
| | | | | | | | | | | | | | | | | Patch adds to mdadm man the following information: --freeze-reshape Option is intended to be used in start-up scripts during initrd boot phase. When array under reshape is assembled during initrd phase, this option stops reshape after reshape critical section is being restored. This happens before file system pivot operation and avoids lost of file system context. Loosing file system context would cause reshape to be broken. Reshape can be continued later using -continue option for grow command. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Verify reshape restart positionAdam Kwolek2011-10-03
| | | | | | | | Check if reshape restart position is the same as set in md. If position doesn't match this means that we cannot restart reshape. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Move code to get_data_disks() functionAdam Kwolek2011-10-03
| | | | | | | Move code to function for code reuse. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add continue option to grow commandAdam Kwolek2011-10-03
| | | | | | | | | | | | | To allow for reshape continuation '--continue' option is added to grow command. Function that will be executed in grow-continue case doesn't require information about reshape geometry. All required information are read from metadata. For external metadata reshape can be run for monitored array/container only. In case when array/container is not monitored run mdmon for it. Signed-off-by: Adam Kwolek <adam.kwolek@intel.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>