summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* imsm: determine failed indexes from the most up-to-date diskDan Williams2008-10-151-0/+7
| | | | | | | | load_imsm_disk() currently notices if spares missed their activation update, but we allow a stale failed disk back in to the array because its serial number is clobbered in the most up-to-date disk. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: manage a list of missing disksDan Williams2008-10-151-9/+98
| | | | | | | | | If a drive is removed while mdmon is not running we need a way to identify what is missing and mark that disk as failed in the metadata. At ->load_super() time create a list of missing disks defined as a disk that is marked in-sync yet does not appear in super->disks. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix mpb_size calculation in write_super_imsmDan Williams2008-10-151-3/+2
| | | | | | | Spotted a thinko... raid devices are dynamically sized, disks are not. The space for disks is always mpb->num_disks * sizeof(struct imsm_disk). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: enable checkpointing of migration (resync/rebuild)Dan Williams2008-10-151-9/+27
| | | | | | | | When the array is shutdown, or when mdadm --wait-clean is called, any active resync process will be idled allowing mdmon to record the current resync position. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Extend --wait-clean to checkpoint resyncDan Williams2008-10-152-3/+13
| | | | | | | | | Root file systems backed by external metadata arrays need to be explicitly checkpointed near the time the rootfs is marked readonly as userspace will not have an opportunity to react to the final shutdown of the array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* --wait-clean: shorten timeoutDan Williams2008-10-152-14/+26
| | | | | | | | | | | | Set the safemode timeout to a small value to get the array marked clean as soon as possible. We don't write 'clean' directly as it may cause mdmon to miss a 'write-pending' event. Include a couple fixes to sysfs_set_safemode(): 1/ 0 pad the milliseconds field 2/ workaround input truncation in the kernel Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* monitor: protect against CONFIG_LBD=nDan Williams2008-10-153-4/+15
| | | | | | | | md/resync_start reports different terminal values depending on kernel configuration (~0UL versus ~0ULL). Make detection of the resync-complete state more robust by comparing against array size. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: trust sector reservation from metadataDan Williams2008-10-151-11/+57
| | | | | | | | On ich6r the option-rom appears to reserve only 432 sectors rather than the 418+4096 of newer implementations. For compatibility trust the metadata in these cases. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* sysfs: dprintf when we fail to write a sysfs fileDan Williams2008-10-153-9/+12
| | | | | | | When arrays do not startup correctly it would be nice to know why. Need to move the dprintf definition to mdadm.h Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: confirm raid10 layout, fix up handling raid10 failuresDan Williams2008-10-151-18/+23
| | | | | | | | 1/ near-2 indeed matches how the Windows driver lays out the data 2/ update imsm_check_degraded to check for rebuilding disks in the raid10 case Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: more serial handling fixupsDan Williams2008-10-151-1/+8
| | | | | | | | zero-initialize the serial buffer to handle cases where the response is less than MAX_RAID_SERIAL_LEN. Tested-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Updates version numbers for 3.0-devel1 release.NeilBrown2008-09-186-4/+102
|
* Don't try to set_array_info when -I find new devices for an array.NeilBrown2008-09-181-2/+10
| | | | | | | | | | | When -I get a new device for a container and tries to incrementally assemble the container array, it calls sysfs_set_array to create the array without first checking if it already exists. This produces unpleasant error messages. So check first. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove .sock file when removing .pid file for mdmonNeilBrown2008-09-181-0/+2
|
* Add support for assembling specific subarrays.NeilBrown2008-09-183-3/+58
| | | | | This normally isn't needed as --incremental does all the work. But it is needed to recognise member= and container= in mdadm.conf
* Use common code to report MD_UUID for --detail --exportNeilBrown2008-09-183-21/+10
| | | | | | As we need to be able to extract a UUID from any superblock for matching, use that as the MD_UUID as it will probably be used for array matching too.
* Report uuid in --detail --brief for ddf and intelNeilBrown2008-09-187-24/+40
| | | | The uuid is slightly fictitious but needed for array matching.
* Use uuid as /dev name when assembling array of uncertain origin.NeilBrown2008-09-184-24/+84
| | | | | If we aren't sure that the array belongs to 'this' host, use the uuid to choose a name to avoid any conflict.
* Add uuid support for super-intel.NeilBrown2008-09-182-7/+47
| | | | | 'imsm' does not provide any real uuid, so we synthesise one from various stable bits of the superblock.
* Allow metadata handler to report that it doesn't record homehost.NeilBrown2008-09-184-5/+5
| | | | | | | For now, this means that the lack of a homehost doesn't always prevent assembly. Soon we will allow assembly anyway, but have different messages if homehost isn't supported.
* Don't allow spares when creating 'external' arrays.NeilBrown2008-09-181-0/+7
| | | | | | | | | | It is meaningless when creating the container, and for subarrays, the container is responsible for assigning spares. Also, don't do the 'spare' fiddle for raid5 as we cannot set up a spare at this point yet. Later maybe just create the array degraded and let the container sort it out.
* Lots of fixes to make incremental assembly of containers work.NeilBrown2008-09-185-75/+121
| | | | | | | | So: mdadm -I /dev/whatever will (if appropriate) add whatever to a container, then start any arrays inside the container.
* Handle incremental assembly of containers.NeilBrown2008-09-184-2/+23
| | | | | | | | | mdadm -I /dev/part-of-container should add that to a container, creating if it needed, and then try to assemble any arrays in the container. Signed-off-by: NeilBrown <neilb@suse.de>
* Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-188-146/+155
| | | | | | | | | | When we assemble an array, there are three different approaches depending on whether metadata is internal or external, and on kernel version. Move all this to a common helper instead of duplicating in 3 places. Signed-off-by: NeilBrown <neilb@suse.de>
* Factor out add-disk codeNeilBrown2008-09-1811-35/+60
| | | | | | | | | | | | | The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
* Ignore leading zeros in version number information.NeilBrown2008-09-182-3/+12
| | | | --detail sometimes generates leading zero which are just noise.
* Allow --config in --incremental mode.NeilBrown2008-09-181-0/+1
|
* Teach --detail about containers and members there-of.NeilBrown2008-09-182-31/+124
| | | | | | | | | | Make --detail on a container more useful by suppressing irrelevant detail and adding useful detail like a list of member arrays. Ditto for members of a container: report the name of the container array. Signed-off-by: NeilBrown <neilb@suse.de>
* Compile fixes, particularly moving more stuff under MDASSEMBLENeilBrown2008-09-188-26/+57
| | | | Now 'make everything' works again.
* Disable compilation with diet-libcNeilBrown2008-09-181-1/+4
| | | | | We need posix_memalign (or something similar) which diet-libc does not provide.
* Fix compile warning/error.NeilBrown2008-09-181-1/+1
| | | | | | | gcc said: error: large integer implicitly truncated to unsigned type Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: recreate socket/pid file on SIGHUPDan Williams2008-09-164-10/+39
| | | | | | | | | | Allow mdmon to start while /var/run/mdadm is readonly. Later a SIGHUP can trigger mdmon to drop its pid and socket once /var/run/mdadm is writable. Of course one needs the pid to send a HUP, that can be stored in a distribution specific rw-init directory... For now, rely on a killall -HUP mdmon to get the files dumped. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* ping_manager() to prevent 'add' before 'remove' completesDan Williams2008-09-164-8/+60
| | | | | | | | | | | | It is currently possible to remove a device and re-add it without the manager noticing, i.e. without detecting a mdstat->devcnt container->devcnt mismatch. Introduce ping_manager() to arrange for mdmon to run manage_container() prior to mdadm dropping the exclusive open() on the container. Despite these precautions sysfs_read() may still fail. If this happens invalidate container->devcnt to ensure manage_container() runs at the next event. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* sysfs: detect disks that are in the process of being removedDan Williams2008-09-161-5/+24
| | | | | | | | | When removing a disk there is a window where the 'slot' attribute of md/dev-$name will return -EBUSY to read attempts. When this happens look at the the 'block' link, if it is removed then we can be sure the device has been removed, versus some other error. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* monitor: clean up some debug messagesDan Williams2008-09-161-2/+3
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mdmon: resume rebuildDan Williams2008-09-161-1/+6
| | | | | | | | If we started a degraded array that was previously rebuilding we may have enough information to resume the rebuild without a trip through the monitor. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: allow a failed disk to be readdedDan Williams2008-09-161-17/+12
| | | | | | | | | Allow the following sequence to rebuild the array mdadm --fail /dev/md/r1 /dev/disk mdadm --remove /dev/imsm /dev/disk mdadm --add /dev/imsm /dev/disk Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* 'mdadm --wait-clean' wait for array to be marked cleanDan Williams2008-09-167-32/+166
| | | | | | | | | For use in distro shutdown scripts with a RAID root file system. Returns immediately if the array is 'readonly', or not an externally managed array. It is up to the distro's scripts to make sure no new writes hit the device after this returns 'true'. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Add ping_monitor() to mdadm --waitDan Williams2008-09-165-18/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The action we are waiting for may not be complete until the monitor has had a chance to take action on the result. The following script can now remove the device on the first attempt, versus a few attempts with the original Wait(): #!/bin/bash #export MDADM_NO_MDMON=1 export IMSM_DEVNAME_AS_SERIAL=1 ./mdadm -Ss ./mdadm --zero-superblock /dev/loop[0-3] echo 2 > /proc/sys/dev/raid/speed_limit_max ./mdadm --create /dev/imsm /dev/loop[0-3] -n 4 -e imsm -a md ./mdadm --create /dev/md/r1 /dev/loop[0-3] -n 4 -l 5 --force -a mdp ./mdadm --fail /dev/md/r1 /dev/loop3 ./mdadm --wait /dev/md/r1 x=0 while ! ./mdadm --remove /dev/imsm /dev/loop3 > /dev/null 2>&1 do x=$((x+1)) done echo "removed after $x attempts" ./mdadm --add /dev/imsm /dev/loop3 Include 2 small cleanups: * remove the almost open coded fd2devnum() in Wait() by introducing a new utility routine stat2devnum() * teach connect_monitor() to parse the container device from a subarray string Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* monitor: don't mark dirty on resync completeDan Williams2008-09-161-1/+1
| | | | | | ...instead look at array state to determine if the array is consistent Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* monitor: mark clean on active-idleDan Williams2008-09-161-3/+7
| | | | | | This also handles the case where 'clean' is set directly. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-164-0/+18
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: use ->getinfo_super() in ->container_content()Dan Williams2008-09-161-30/+16
| | | | | | | | * allows container_content() to pick up the safemode_delay * removes some duplicate code * fixes an endian bug setting info->array.chunk_size Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Allow metadata handlers to communicate desired safemode delay via mdinfoDan Williams2008-09-165-0/+7
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Makefile: Add mdmon header dependenciesDan Williams2008-09-161-1/+2
| | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix up serial handlingDan Williams2008-09-161-20/+34
| | | | | | | * Trim trailing and leading whitespace * Allow unterminated serial numbers up to MAX_RAID_SERIAL_LEN Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: only use the device name as a fallback when IMSM_DEVNAME_AS_SERIAL=1Dan Williams2008-09-161-7/+5
| | | | | | Also ensure that the serial buffer is initialized. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: rectify map handlingDan Williams2008-09-161-62/+132
| | | | | | | | | | The secondary map is used to reflect the migration state of the array i.e. from dev->vol.map[1] to dev->vol.map[0]. Ensure a rebuilding / initializing array is marked in the second map, while normal status is reflected in the first map. Also mark rebuilding drives with IMSM_ORD_REBUILD. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: fix imsm_delete()Dan Williams2008-09-161-20/+30
| | | | | | | * fix breakage from last merge (infinite loop in imsm_process_update()) * add ability to delete by index Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* imsm: use IMSM_ORD_REBUILD instead of USABLE flagDan Williams2008-09-161-16/+21
| | | | | | | IMSM_ORD_REBUILD is the 'insync' flag in MD terms. USABLE is a flag to opt-in disks for use with the Windows driver. Signed-off-by: Dan Williams <dan.j.williams@intel.com>