summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* 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>
* Help: use an array to choose which help matches which mode.NeilBrown2012-07-09
| | | | | | Looks cleaner than a big switch statement. Signed-off-by: NeilBrown <neilb@suse.de>
* main: extract more functions.NeilBrown2012-07-09
| | | | | | | extract misc_scan stop_scan misc_list from main to try to make main() a little more manageable. Signed-off-by: NeilBrown <neilb@suse.de>
* main: split scan_assemble into a separate functionNeilBrown2012-07-09
| | | | | | main is too big. This makes it a little more manageable. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.c: various minor clean-upsNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use explicit non-char opt for --zero-superNeilBrown2012-07-09
| | | | | | | | As we don't allow '-K' for '--zero-super' there is no point using it internally. Just define a 'KillOpt' like with other options. Signed-off-by: NeilBrown <neilb@suse.de>
* ReadMe: various updates and corrections.NeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: fix arg parsing.NeilBrown2012-07-09
| | | | | | | | -t aka --takeover should not be setting container_name. It sets it to NULL which causes failure when you try mdmon --all --takeover Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: fix reporting for Fail vs FailSpare etc.NeilBrown2012-06-04
| | | | | | | | | | | | The tests here were specific to 0.90 metadata and didn't work properly for 1.x metadata, where a device's "number" doesn't change. By checking if this is a new array we can avoid some corner cases. Then we test mostly based on state and not based on 'number' at all. Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: Report NewArray when an array the disappeared, reappears.NeilBrown2012-06-04
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: fix inconsistencies in values for ->percentNeilBrown2012-06-04
| | | | | | | | | | | | | ->percent sometimes stores negative values recording states like 'pending' or 'delayed'. The value '-2' means both 'delayed' and in Monitor, 'unknown'. Also, '-1' has a meaning but not #define. So change the #defines to be prefixed with "RESYNC_", instead of "PROCESS_", add new "_NONE" and "_UNKNOWN", and use correct value in each location. Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: Allow correct monitoring of more member devices.NeilBrown2012-06-04
| | | | | | | Having "MaxDisks == 384" is not good. Discard it in favour of MAX_DISKS which is 4096 Signed-off-by: NeilBrown <neilb@suse.de>
* Detail: show which 'set' each device in a RAID10 belongs toNeilBrown2012-05-30
| | | | | | | | | | | | | | | A RAID10 can be though of as having 2 sets of devices (if there are 2 copies and an even number of devices in total). With this patch "mdadm --detail" shows which 'set' each device belongs to - set-A or set-B. If there are more than 3 copies, there can be more than 3 sets. If the number of copies does not evenly divide the number of devices, there are not distinct 'sets' so none are reported. Signed-off-by: NeilBrown <neilb@suse.de>
* New tests testing removal of internal bitmapsJes Sorensen2012-05-30
| | | | | | | | To match the add-bitmap tests, here is a set of tests checking the removal of bitmaps. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* New tests testing the addition of bitmapsJes Sorensen2012-05-30
| | | | | | | | | | This set of tests verifies that it is possible to add an internal bitmap to an existing array, and that the device can be written to after the bitmap is added. This should catch cases such as the one fixed by 4474ca42e2577563a919fd3ed782e2ec55bf11a2 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix --no-error in test scriptJes Sorensen2012-05-30
| | | | | | | | | | | b8e91a32cdaa2a6dea8b0dd54365ede33d5a9a60 was applied incorrectly. It changed the name of the variable set when specifying --no-error, without changing the places checking it. Set it back as it was to make --no-error work correctly again. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: correct checking volume's degradationLukasz Dorau2012-05-29
| | | | | | | | | | | | | | | | | | | | We do not check the return value of sysfs_get_ll() now. It is wrong. If reading of the sysfs "degraded" key does not succeed, the "new_degraded" variable will not be initiated and accidentally it can have the value of "degraded" variable. In that case the change of degradation will not be checked. It happens if mdadm is compiled with gcc's "-fstack-protector" option when one tries to stop a volume under reshape (e.g. OLCE). Reshape seems to be finished then (metadata is in normal/clean state) but it is not finished, it is broken and data are corrupted. Now we always check the return value of sysfs_get_ll(). Even if reading of the sysfs "degraded" key does not succeed (rv == -1) the change of degradation will be checked. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: Fix Segmentation fault.majianpeng2012-05-29
| | | | | | | | | | | | | In function write_init_super1(): If "rv = store_super1(st, di->fd)" return error and the di is the last. Then the di = NULL && rv > 0, so exec: if (rv) fprintf(stderr, Name ": Failed to write metadata to%s\n", di->devname); will be segmentation fault. Signed-off-by: majianpeng <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Move setup code to a function and introduce matching cleanup argumentJes Sorensen2012-05-28
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Improve --help message from testJes Sorensen2012-05-28
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add --no-error argument to 'test'Jes Sorensen2012-05-28
| | | | | | | | This allows the test suite to run to completion even if one test fails. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add support for saving log files in test scriptJes Sorensen2012-05-28
| | | | | | | | --logdir= specifies where to save, if different from default, and --save-logs tells test to save all log files. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Increase minimum chunk size in testsuite to 64kBAnton Blanchard2012-05-24
| | | | | | | | | | | When running the mdadm testsuite on ppc64 with a 64kB page size I see a couple of failures because the chunk size is smaller than a page. Bump the chunksize to 64kB to fix these failures. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: NeilBrown <neilb@suse.de>
* udev-rules: prevent systemd from mount devices before they are ready.NeilBrown2012-05-24
| | | | | | | | | | | When an array is assembled incrementally, systemd might see it before it is ready, try to mount it, fail, and give up. Result is that array doesn't get mounted. If we ask udev to tell systemd that it isn't ready yet in this case, systemd waits until it is ready, and all are happy. Signed-off-by: NeilBrown <neilb@suse.de>
* Add command line argument parsing to 'test' sriptJes Sorensen2012-05-23
| | | | | | | | | | This adds more generic command line argument parsing to the test script. It also introduces a couple of new options, while preserving the old '<prefix>' and 'setup' arguments. The new options are --disable-multipath and --tests=<test1>,<test2>,... Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Check for multipath module before running multipath testsJes Sorensen2012-05-23
| | | | | | | | Some systems do not ship the md multipath module. If not available simply skip any multipath tests. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create new release: 3.2.5NeilBrown2012-05-18
| | | | | | | Fix a serious regression in 3.2.4 which caused "--add" to often fail. Other minor fixes included. Signed-off-by: NeilBrown <neilb@suse.de>
* Update some device sizes for self tests.NeilBrown2012-05-18
| | | | | | | | A recent change means that devices smaller than 1Gig no longer have 1Meg wasted at the start. So we must adjust some sizes again. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: check if size of expansion is not larger than maximumLukasz Dorau2012-05-18
| | | | | | | | | | | | | We do not check if requested size of expansion is larger than maximum available size now. If it is larger the output message is a bit misleading, for example: mdadm: Cannot set size on array members. mdadm: Cannot set device size for /dev/md/vol: Device or resource busy Now we check if requested size of expansion is larger than maximum available size and the appropriate output message was added. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix a typo in fprintf messageLukasz Dorau2012-05-18
| | | | | Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.conf.5: typo: of -> orNeilBrown2012-05-18
| | | | | | Addresses-Debian-bug: 673344 Reported-by: Robert Henney <robh@rut.org> Signed-off-by: NeilBrown <neilb@suse.de>
* RebuildMap: check that container_content returns a valid 'info'.NeilBrown2012-05-17
| | | | | | | If it doesn't, just skip that entry. Reported-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't consider disks with a valid recovery offset as candidates for bumping ↵Alexander Lyakas2012-05-15
| | | | | | | | | | | | up event count When we are looking for a candidate disk to bump up the event count, we consider only disks that have recovery_start==MaxSector. However, after we find one such disk, we agree to accept more disks having same event count, regardless of their recovery_start. Be consistent and don't accept disks with a valid recovery_start at all. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: don't print message if unfreezing fails.NeilBrown2012-05-15
| | | | | | | | This is most likely to happen if the array has been stopped, in which case the error is pointless. Reported-by: Patrik Horník <patrik@dsl.sk> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix --layout=preserve to match man page.NeilBrown2012-05-15
| | | | | | | | | | | I think there was some confusion about what --layout=preserve actually means, but in any case it wasn't doing what the man page says it should. So add some case analysis and make sure it does the right thing, or complains if it cannot. Reported-by: Patrik Horník <patrik@dsl.sk> Signed-off-by: NeilBrown <neilb@suse.de>
* super1: fix choice of data_offset.NeilBrown2012-05-15
| | | | | | | | | | | | | | While it is nice to set a high data_offset to leave plenty of head room it is much more important to leave enough space to allow of the data of the array. So after we check that sb->size is still available, only reduce the 'reserved', don't increase it. This fixes a bug where --adding a spare fails because it does not have enough space in it. Reported-by: nowhere <nowhere@hakkenden.ath.cx> Signed-off-by: NeilBrown <neilb@suse.de>
* New sha1.c and sha1.hNeilBrown2012-05-15
| | | | | | | | | | | These are from: http://gcc.gnu.org/svn/gcc/branches/cilkplus/include/sha1.h and http://gcc.gnu.org/svn/gcc/branches/cilkplus/libiberty/sha1.c and hopefully avoid aliasing issues. Signed-off-by: NeilBrown <neilb@suse.de>
* Create new release: 3.2.4NeilBrown2012-05-09
| | | | | | Bugfix release Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Fix resource leak from opendir()Jes Sorensen2012-05-07
| | | | | | | | Use closedir() on dirp from opendir() to avoid resource leaking. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Don't try to close negative fdJes Sorensen2012-05-07
| | | | | | | | | This should be harmless, but lets be consistent and not try to close a negative file descripter. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: failing the set the per-device size is not an error.NeilBrown2012-05-03
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* test: don't worry too much about array size.NeilBrown2012-05-03
| | | | | | | | With different amounts of space being reserved for metadata it is hard for the script to know how big the array should be. So allow a bit of slack. Signed-off-by: NeilBrown <neilb@suse.de>
* Adjust to new standard of /runNeilBrown2012-05-03
| | | | | | | | Now that /run seems to be a good standard, make that the default for storing various run-time files, rather than /var/run or /dev/.mdadm. Signed-off-by: NeilBrown <neilb@suse.de>
* Update test for "is udev active".NeilBrown2012-05-03
| | | | | | | | Newer udev doesn't use /dev/.udev any more. it used /run/udev instead. So test for that as well. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: thunderdome may drop 2tb attributeCzarnowska, Anna2012-04-30
| | | | | | | | | | | | Spare superblock doesn't depend on other spares in container. When loading container metadata thunderdome may pick a small disk for the champion. This will result in incorrect interpretation of sizes of other disks in container when joint superblock is returned. If any disk in container has the 2TB attribute set, the result must have it set too. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce sysfs_set_num_signed() and use it to set bitmap/offsetJes Sorensen2012-04-30
| | | | | | | | | | mdinfo->bitmap_offset is a signed long and needs to be treated as such when passed to the kernel. This resolves the problem with adding internal bitmaps to a 1.0 array. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix sign extension of bitmap_offset in super1.cJes Sorensen2012-04-30
| | | | | | | | | | fbdef49811c9e2b54e2064d9af68cfffa77c6e77 incorrectly tried to fix sign extension of the bitmap offset. However mdinfo->bitmap_offset is a u32 and needs to be converted to a 32 bit signed integer before the sign extension. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: correct extending size of raid0 arrayLukasz Dorau2012-04-23
| | | | | | | | | Setting "sync_action" to "idle" while extending size of raid0 array is racy and sometimes fails. "sync_action" should be set to "frozen" instead. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>