summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Assemble: ignore devices= if container= is present.NeilBrown2013-07-02
| | | | | | | | | | | | | | If "container=" is present, then we are going to assemble from the given container where that container is made of those devices or not. So in this case the "devices=" is purely documentation and is best ignored. As part of this, move the test on the "container=" value when that start with "/" up before the device is opened. There sooner we test things, the better. Reported-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* Config: use better device names for "DEVICES container"NeilBrown2013-07-02
| | | | | | | | | | When "containers" appears on the "DEVICES" line (which is does by default), use names from the mdadm map file instead of kernel names, when possible. This mean that the name will be more likely to appear in mdadm.conf and so more likely to match "container=" tags. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: write raid-disks should be less fatal.NeilBrown2013-07-02
| | | | | | | | If the container metadata doesn't know how many device to expect (as is the case with IMSM), don't fail an --assemble which over-specifies the number of devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Move find_free_devnum to mdopen.cNeilBrown2013-07-02
| | | | | | | | | There is only one called to find_free_devnum and it is in mdopen.c The removes a dependency between util.c and config.c which allows us to now drop config.o from mdmon. Signed-off-by: NeilBrown <neilb@suse.de>
* Move conf_line and free_line from conf.c to lib.cNeilBrown2013-07-02
| | | | | | | | | As they are uses for mdstat as well as mdadm.conf, they don't really belong in conf.c This removes a dependency between mdmon and conf.c Signed-off-by: NeilBrown <neilb@suse.de>
* Detail: Factor out add_device()Martin Wilck2013-07-02
| | | | | | | Makes the code a little more readable. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.8.in: Fix typo: previous -> previouslyNeilBrown2013-07-02
| | | | | Signed-off-by: Wieland Hoffmann <themineo@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: check alignment when stopping an array undergoing reshape.NeilBrown2013-07-01
| | | | | | | | | | | | | To be able to revert-reshape of raid4/5/6 which is changing the number of devices, the reshape must has been stopped on a multiple of the old and new stripe sizes. The kernel only enforces the new stripe size multiple. So we enforce the old-stripe-size multiple by careful use of "sync_max" and monitoring "reshape_position". Signed-off-by: NeilBrown <neilb@suse.de>
* New function: sysfs_waitNeilBrown2013-07-01
| | | | | | | We have several places that wait for activity on a sysfs file. Combine most of these into a single 'sysfs_wait' function. Signed-off-by: NeilBrown <neilb@suse.de>
* revert-reshape: make sure reshape_position is acceptable.NeilBrown2013-06-27
| | | | | | | | | | We can only revert a reshape if the reshape_position aligns properly for the old geometry. If it doesn't we just fail for now. Also fix a +/- error with updating raid_disks for super1.c Signed-off-by: NeilBrown <neilb@suse.de>
* tests/raid6repair: default data offset has changed.NeilBrown2013-06-27
| | | | | | So the test scripts must change too. Signed-off-by: NeilBrown <neilb2suse.de>
* "make test" should build "raid6check"NeilBrown2013-06-27
| | | | | | As there are selftests for raid6check. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: remove some stray tracing.NeilBrown2013-06-27
| | | | | | | Was introduced in: Assemble: when forcing a single-degraded RAID6 array, trigger a 'repair'. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix crash when restarting an array.NeilBrown2013-06-27
| | | | | | | After the 'started' label it is assumed that 'sra' is set, so better set it when jumping there. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: lack of head/tail space not fatal for RAID5 etc.NeilBrown2013-06-27
| | | | | | | | | For RAID10, we must have head/tail space for reshape. For RAID4/5/6 we can use a spare or a backup file. So make that distinction. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: report better message when --grow --chunk cannot work.NeilBrown2013-06-27
| | | | | | | | | | | When changing the chunksize of an array, the new chunksize must divide the device size. If it doesn't we report a very brief message. Make this message a bit longer and suggest a way forward be reducing the size of the array. Reported-by: Mark Knecht <markknecht@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Makefile/version: use version/date from .git if possible.NeilBrown2013-06-25
| | | | | | | | If being built from a git tree, use the version and date information from the top commit rather than the hard-coded values. Signed-off-by: NeilBrown <neilb@suse.de>
* Subject: Make wait_for and open_dev_excl fasterNeilBrown2013-06-25
| | | | | | | | | | | | | | | | | | When we crete or assemble an array, we wait for udev to create the device file in /dev so that as soon as mdadm complete, the device can be used. This waiting is performed in multiples of 200ms, which can sometimes be too long to wait. So change to an exponential backoff. Wait 1, then 2, then 4 msec etc. Once we get to 256msec, stop backing off and continue waiting 256ms at a time until we reach the limit which is now 4.608sec rather than 5sec which it was before. Ditto for open_dev_excl. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: add device size tests when change raid leve to/from 0NeilBrown2013-06-25
| | | | | | There was a kernel bug that got this wrong, so better check for it. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix bug in raid0 -> raid5 conversion.NeilBrown2013-06-25
| | | | | | | | | | The moment we change a RAID0 to a RAID5 it will try to recovery. This will abort quite quickly as there are not spare devices, but it could confuse the attempt to freeze the array. So allow 'freeze' to work even on a recovering array. Signed-off-by: NeilBrown <neilb@suse.de>
* Make: CXFLAGS should be conditionally assigned.NeilBrown2013-06-24
| | | | | | | | | | As the Makefile encourages users to set CXFLAGS for extra flags, we should only conditionally set it. That way it can be over-ridden in the environment as well as on the command line. Suggested-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de> Signed-off-by: NeilBrown <neilb@suse.de>
* Detail: deterministic ordering in --brief --verbosemwilck@arcor.de2013-06-24
| | | | | | | | | | | | | | | | Have mdadm --Detail --brief --verbose print the list of devices in alphabetical order. This is useful for debugging purposes. E.g. the test script 10ddf-create compares the output of two mdadm -Dbv calls which may be different if the order is not deterministic. (I confess: I use a modified "test" script that always runs "mdadm --verbose" rather than "mdadm --quiet", otherwise this wouldn't happen in 10ddf-create). Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* super1: fix space_{before,after} for RAID0NeilBrown2013-06-24
| | | | | | For RAID0 we need to use 'data_size', no 'size' as later is 0. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: allow "--add" with "--grow --level=??"NeilBrown2013-06-24
| | | | | | | This is useful for reshaping a RAID0 to a higher level. The recovery will happen at the same time as the reshape. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: chose default layout when converting from RAID0.NeilBrown2013-06-24
| | | | | | | If we don't do this explicitly, we end up keeping the "current" layout, which is meaningless for RAID0. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: add test for converting levels to raid0 and back.NeilBrown2013-06-24
| | | | | | | Now that I have this mostly working, I should make sure it doesn't break... Signed-off-by: NeilBrown <neilb@suse.de>
* test/00names: use appropriate mdadm.confNeilBrown2013-06-24
| | | | | | | Using non-numeric names needs an mdadm.conf setting, so make sure we have one. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: centralise level-change code.NeilBrown2013-06-24
| | | | | | | | | | There are now 3 places which change level. And they all do it slightly differently with different messages etc. Make a single function for this and use it. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: remove excess drives when converting to RAID0.NeilBrown2013-06-24
| | | | | | | | | When converting to RAID0, all spares and non-data drives need to be removed first. It is possible that the first HOT_REMOVE_DISK will fail because the personality hasn't let go of it yet, so retry a few times. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: clear new_layout when we change the level.NeilBrown2013-06-24
| | | | | | | After changing the level, the meaning of layout numbers changes, so we will keeping a new_layout value around can cause later confusion. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: analyse_change needs to set new_size even if nothing much is happening.NeilBrown2013-06-24
| | | | | | | This means it will be set for a "--data-offset" only reshape so that case doesn't complain that the array is getting smaller. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix two problems with new_data_offsetNeilBrown2013-06-24
| | | | | | | | | 1/ ignore failed devices - obviously 2/ We need to tell the kernel which direction the reshape should progress even if we didn't choose the particular data_offset to use. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: Try hard to set new_offset.NeilBrown2013-06-24
| | | | | | | | | Setting new_offset can fail if the v1.x "data_size" is too small. So if that happens, try increasing it first by writing "0". That can fail on spare devices due to a kernel bug, so if it doesn't try writing the correct number of sectors. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: Make sure new data-offset is well-alignedNeilBrown2013-06-24
| | | | | | | If we choose a new data-offset, make sure it is rounded to a largest power of to possible, up to 1Meg Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: a data_offset should not be tested against 0.NeilBrown2013-06-19
| | | | | | It should always be tested against INVALID_SECTORS!!! Signed-off-by: NeilBrown <neilb@suse.de>
* tests: add test for non-numeric device namesNeilBrown2013-06-19
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Add test for interaction of --assemble with --incrNeilBrown2013-06-19
| | | | | | | and fix the bug that it found. The refactor of start_array() missed a test. Signed-off-by: NeilBrown <neilb@suse.de>
* Add test for --update=metadata and fix bug it found.NeilBrown2013-06-19
| | | | | | We were not setting device size correctly for raid0. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: rearrange sometest groupings.NeilBrown2013-06-19
| | | | | | | All 'update' tests in 04 More imsm tests in 09 Signed-off-by: NeilBrown <neilb@suse.de>
* Remove lots of unnecessary white space.NeilBrown2013-06-19
| | | | | | | Now that I am using white-space mode in Emacs I can see all of this, and I don't like it :-) Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: allow "--stop" on kernel names.NeilBrown2013-06-19
| | | | | | | | | e.g. mdadm --stop md4 This works even if udev has become confused or killed. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: split Manage_runstop into Manage_run and Manage_stopNeilBrown2013-06-19
| | | | | | | The two branches have virtually nothing in common, so it is simpler if they are separate. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: when forcing a single-degraded RAID6 array, trigger a 'repair'.NeilBrown2013-06-19
| | | | | | | | | | | | | | | | When an active/degraded RAID6 array is force-started we clear the 'active' flag, but it is still possible that some parity is no in sync. This is because there are two parity block. It would be nice to be able to tell the kernel "P is OK, Q maybe not". But that is not possible. So when we force-assemble such an array, trigger a 'repair' to fix up any errant Q blocks. This is not ideal as a restart during the repair will not be continued after the restart, but it is the best we can do without kernel help. Signed-off-by: NeilBrown <neilb@suse.de>
* Detail: add device information to --detail --exportNeilBrown2013-06-19
| | | | | | | We may well want more per-device information here, but this is a start. Signed-off-by: NeilBrown <neilb@suse.de>
* sysfs_read: return devices in same order as in filesystem.NeilBrown2013-06-19
| | | | | | | | When we read devices from sysfs (../md/dev-*), store them in the same order that they appear. That makes more sense when exposed to a human (as the next patch will). Signed-off-by: NeilBrown <neilb@suse.de>
* raid6check: Check return value of lseek64()Bernd Schubert2013-06-19
| | | | | | | | If lseek64() failed it was still writing to the disks, which would introduce data corruption. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> Signed-off-by: NeilBrown <neilb@suse.de>
* raid6check: Fix compiler warnings.Bernd Schubert2013-06-19
| | | | | | | Fix some compiler warnings appearing with optimization levels. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> Signed-off-by: NeilBrown <neilb@suse.de>
* raid6check: Use enums for repair typeBernd Schubert2013-06-19
| | | | | | | Using hard coded numbers is error prone and hard to read by humans. Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> Signed-off-by: NeilBrown <neilb@suse.de>
* raid6check: Fix memory leaks detected by valgrindBernd Schubert2013-06-19
| | | | | | | | | | | | | | | | | | ==2389947== 24 bytes in 1 blocks are definitely lost in loss record 1 of 10 ==2389947== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2389947== by 0x408067: xmalloc (xmalloc.c:36) ==2389947== by 0x401B19: check_stripes (raid6check.c:151) ==2389947== by 0x4030C6: main (raid6check.c:521) ==2389947== ==2389947== 24 bytes in 1 blocks are definitely lost in loss record 2 of 10 ==2389947== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2389947== by 0x408067: xmalloc (xmalloc.c:36) ==2389947== by 0x401B67: check_stripes (raid6check.c:155) ==2389947== by 0x4030C6: main (raid6check.c:521) ==2389947== Signed-off-by: Bernd Schubert <bernd.schubert@fastmail.fm> Signed-off-by: NeilBrown <neilb@suse.de>
* raid6check: Fix build of raid6checkBernd Schubert2013-06-19
| | | | | | | | | | | | | After recent git pull 'make raid6check' did not work anymore, as sysfs_read() was called with a wrong argument and as check_env() was used by use_udev(), but not defined. Replace sysfs_read(..., -1, ...) by sysfs_read(..., NULL, ...) Move check_env() from util.c to lib.c Signed-off-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de> Signed-off-by: NeilBrown <neilb@suse.de>