summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Grow: be even more careful about handing a '0' completed value.NeilBrown2015-05-151-1/+3
| | | | | | | | | | | | Some old kernels set 'completed' to '0' too soon. But modern kernels don't. And when 'mdadm --stop' freezes and resume the grow, 'completed' goes back to zero briefly, which can confuse this logic. So only think '0' might be wrong from an old kernel when the reshape has gone idle. Signed-off-by: NeilBrown <neilb@suse.de>
* tests/07reshape5intr : retry if writing 'check' fails.NeilBrown2015-05-151-1/+1
| | | | | | It can sometimes. Signed-off-by: NeilBrown <neilb@suse.de>
* tests/19raid6repair: don't flushbufs on non-existent array.NeilBrown2015-05-151-1/+1
| | | | | | ..that triggers an error. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: wait for complete rebuild in integrity checksNeilBrown2015-05-152-3/+3
| | | | | | | 'check wait' seems a bit racy now. Wait for the array to be fully optimal before proceeding. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: retry when writing 'reshape' to 'sync_action' is EBUSY.NeilBrown2015-05-151-3/+8
| | | | | | | | | | | | EBUSY can be returned if something has recently happened to cause md to want to check if recovery is needed, but hasn't had a chance yet. This can easily happen in testing. So retry a few times in that case. Signed-off-by: NeilBrown <neilb@suse.de>
* tests/05r6tor0: minor adjustmentsNeilBrown2015-05-151-2/+4
| | | | | | | 1/ use correct data-offset for cmp - that has changed. 2/ flushbufs on the block device before reading to avoid cache issues Signed-off-by: NeilBrown <neilb@suse.de>
* tests: 05r6tor0 - add some more waiting.NeilBrown2015-05-151-5/+5
| | | | | | | | I don't really know why this is needed, but there is a delay between the reshape finishing and the level/etc changing. So add some sleeps. Signed-off-by: NeilBrown <neilb@suse.de>
* tests/imsm-grow-template: sleep a bit more.NeilBrown2015-05-151-0/+2
| | | | | | | | | | The current sleep/wait doesn't seem long enough, particularly when two arrays are being reshaped in the one container. So wait a bit more... Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: be more careful if array is stopped during critical section.NeilBrown2015-05-151-3/+10
| | | | | | In that case, updating 'completed' to 'max_progress' is wrong. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: add missing space in message.NeilBrown2015-05-151-1/+1
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: only warn about incompatible metadata when no fallback available.NeilBrown2015-05-141-1/+3
| | | | | | | | We might be trying to set_new_data_offset() for RAID10, when it is a necessary requirement, or for RAID5 where it is optional. In the latter case, a message about metadata versions is no helpful. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: when re-adding, do check avail size if ->sb cannot be found.NeilBrown2015-05-131-1/+2
| | | | | | | | | | | | | avail_size1 requires ->sb, so we must only call it if ->sb was loaded. If ->sb wasn't loaded, then we are only proceding on the basis that the kernel might be able to work something out - we don't need to do any tests on size. Reported-by: Christoffer Hammarström <christoffer.hammarstrom@linuxgods.com> Signed-off-by: NeilBrown <neilb@suse.de> URL: https://bugs.debian.org/784874
* tests: don't "dd" indefinitely.NeilBrown2015-05-131-2/+2
| | | | | | This will trigger an error. And now that errors are fatal.... Signed-off-by: NeilBrown <neilb@suse.de>
* tests: ignore failure status from mdadm -IRsNeilBrown2015-05-133-4/+4
| | | | | | | | | This can report non-zero if there was nothing to do, and that isn't really an error. If the array doesn't get started, something else will complain. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: don't check for pre-existing array when updating uuid.NeilBrown2015-05-131-1/+4
| | | | | | | This is a very corner-case, but the self-tests tripped on it, and it makes sense not to trust the uuid when it is being changed. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: _write_super_to_disk: fix anchor header typeMartin Wilck2015-05-131-0/+1
| | | | | | | | | | | | | Since commit 30bee0201, the anchor is updated from the active DDF header. This requires fixing the header type before the anchor is written. The LSI Software RAID code will reject DDF meta data with wrong anchor type and will erase all meta data when it encounters such a broken anchor. Thus starting Linux md once on a system with LSI RAID BIOS may cause the meta data to get destroyed. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: never fail if --wait fails.NeilBrown2015-05-0712-18/+18
| | | | | | | | | "--wait" will return non-zero status if it didn't need to wait. This is no a reason to fail a test. So ignore the return status from those commands. Signed-off-by: NeilBrown <neilb@suse.de>
* Add "Name" defines to some ancillary programsNeilBrown2015-05-072-0/+3
| | | | | | | All programs now need to declare their "Name". Signed-off-by: NeilBrown <neilb@suse.de> Fixes: d56dd607ba43 ("Change way of printing name of a process")
* Manage: fix test for 'is array failed'.NeilBrown2015-05-061-1/+1
| | | | | | | | | | We 'active_disks' does not count spares, so if array is rebuilding, this will not necessarily find all devices, so may report an array as failed when it isn't. Counting up to nr_disks is better. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: Count arrays per oromPawel Baldysiak2015-04-093-29/+71
| | | | | | | | | | | Active arrays with IMSM metadata are counted per hba so far. This is bad due to new functionality of orom shared between multiple controllers i.e. more arrays can be created than is supported by orom. This patch changes the way of counting arrays, so the result will be sum of arrays under every hba supported by specific orom. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/force: make it possible to "force" a new device in a reshape.NeilBrown2015-04-081-5/+30
| | | | | | | | | | | | | | Normally we do not "force"-assemble devices which are in the middle of recovery, as they are unlikely to have useful data. However, when a reshape increases the number of devices, the newly added devices appear to be recovering because they do not have complete data on them yet, but then they aren't expected to until the reshape completes. So in this case, it can be appropriate to force-assemble them. Reported-by: "Jonathan Harker (Jesusaurus)" <jesusaurus@gentlydownthe.net> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: remove stray ':' from error message.NeilBrown2015-04-081-1/+1
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow a RAID4 to assemble easily when parity devices is missing.NeilBrown2015-04-081-0/+7
| | | | | | | | | | | | If the parity device of a RAID4 is missing, then there is no immediate risk to data. So it doesn't matter if the array is dirty or not. This can be important when reshaping a RAID0, and is a much better solution that that in the resent-reverted. b720636a5849397dbc6dc1b0f0b671d17034a28b Reported-by: "Jonathan Harker (Jesusaurus)" <jesusaurus@gentlydownthe.net> Signed-off-by: NeilBrown <neilb@suse.de>
* Revert "Assemble: support assembling of a RAID0 being reshaped."NeilBrown2015-04-081-3/+1
| | | | | | | | | | This reverts commit b720636a5849397dbc6dc1b0f0b671d17034a28b. As it said, this was a hack. It causes problems when trying to --force assemble a RAID4. There is a better way. Reported-by: "Jonathan Harker (Jesusaurus)" <jesusaurus@gentlydownthe.net> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: fix "no uptodate device" message.NeilBrown2015-04-081-1/+1
| | | | | | | | | Since we introduced replacement devices, the 'i' used in start_array() is twice the slot number. So we need to adjust when printing. Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: use the "space protocol" for "Wrong-Level".NeilBrown2015-04-081-1/+1
| | | | | | | "Wrong-Level" is a reason, not a component device, so it should start with a space to indiciate this to alert(). Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: Obey "space protocol" when writing to syslog.NeilBrown2015-04-081-1/+5
| | | | | | | | | | | "alert" treats the "disc" arg differently if it starts with a space. At least it does for sending email. It doesn't for writing to syslog. Make this consistent and obey the 'space protocol' when writing to syslog. Signed-off-by: NeilBrown <neilb@suse.de>
* reshape: support raid5 grow on certain older kernels.NeilBrown2015-03-261-2/+13
| | | | | | | | | | | | | | | | | Kernels between c6563a8c38fde3c1c7fc925a v3.5-rc1~110^2~53 and b5254dd5fdd9abcacadb5101 v3.5-rc1~110^2~51 allow new_offset to be set, but don't then allow a RAID5 to be reshaped to change that offset. Due to selective backports, this includes the SLES11-SP3 kernel. It is quite easy to handle this case in mdadm, so we do. Specifically: if the reshape with data-offset fails with EINVAL, abort the data-offset change and try the "old" way. Signed-off-by: NeilBrown <neilb@suse.de>
* IncRemove: Set "auto-read" only after successful excl open.Pawel Baldysiak2015-03-041-6/+10
| | | | | | | | | | | | | "mdadm -If" - triggered from udev rules when disk is removed from OS - tries to set array in auto-read-only mode. This can interrupt rebuild process which is started automatically, e.g. if array is mounted and spare disk is available (I/O error is detected faster than removing failed disk by mdadm). This patch prevents "mdadm -If" from setting array into "auto-read-only", by requiring exclusive open to succeed. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM-orom: make sure, that device list is supportedPawel Baldysiak2015-03-041-1/+4
| | | | | | | | Devices list in PCI Data Structure is supported only in 3 and above revision. Make sure that this is checked. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: simplified multiple OROMs supportArtur Paszkiewicz2015-03-043-61/+57
| | | | | | | | | Replaced oroms array with list, add_orom() now only appends to this list and add_orom_device_id() only appends devid_list node to an orom_entry. Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: don't ignore the return value from stat.NeilBrown2015-03-041-7/+6
| | | | | | | | | static checkers complain about that. So change the code to use 'fstat', as we really don't want to see an error here.. Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* write_super_imsm_spares(): C statements are terminated by ;Jes Sorensen2015-03-041-6/+6
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IncrementalScan(): Make sure 'st' is valid before dereferencing itJes Sorensen2015-03-041-1/+1
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow.c: Fix classic readlink() buffer overflowJes Sorensen2015-02-251-1/+1
| | | | | | | | The buffer passed on to readlink() needs to contain space for the terminating \0. See 'man 3 readlink' for details. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't break long strings onto multiple lines.NeilBrown2015-02-1221-582/+275
| | | | | | | | | | | | | | | | | It is best to keep strings all together so that they are easier to search for in the source code. If a string is so long that it looks ugly one line, them maybe it should be broken into multiple lines for display too. Only strings which contain a newline can be broken into multiple lines: "It is OK to\n" "break this string\n" Signed-off-by: NeilBrown <neilb@suse.de>
* Consistently print program Name and __func__ in debug messages.NeilBrown2015-02-1214-272/+225
| | | | | | | | | | | | make dprintf() print program name and __func__, so that this messaging is consistent. Also remove all __func__ messages from pr_err(). We shouldn't leak that internal data in error message. If we really want function name there, we new pr_XXX might be wanted. Signed-off-by: NeilBrown <neilb@suse.de>
* Change way of printing name of a processPawel Baldysiak2015-02-1211-31/+37
| | | | | | | | | | | | | Sometimes mdadm prints messages with wrong name "mdmon", and vice versa. This patch solves this problem by changing method of determining process name. Now "Name" will be set in const at start of a program, previously was hardcoded as #define. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: fix for regression with container devicesArtur Paszkiewicz2015-02-111-4/+10
| | | | | | | | | | | This patch fixes 2 problems introduced by commit 9a518d8: not closing a file descriptor and ignoring container devices. Array state is always "inactive" for containers, so we make sure that the device is not a container by reading also the "level" sysfs entry. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdcheck: be careful when sourcing the output of "mdadm --detail --export"NeilBrown2015-02-041-1/+1
| | | | | | | | | | The output of "mdadm --detail --export" isn't quoted properly so fields that contain spaces can be a problem. We only want the MD_UUID field, and it has a very well defined format with no spaces. So use 'grep' to limit the output to just that. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: Clear migration record on disks more oftenPawel Baldysiak2015-01-291-0/+26
| | | | | | | | | | | Migration record is not always cleared after successful migration. This can block another reshape from being started. Migration will not be continued via systemd service due to error in verifying reshape position. This patch added clearing migration record when disk is added to container, and after successful migration. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* util: remove rounding error where reporting "human sizes".NeilBrown2014-12-181-4/+4
| | | | | | | | | | | | | | | | | The division 1<<20 / 200 is not exact, so dividing by this to convert bytes into half-megs is wrong and results in incorrect output. As we are doing "long long" arithmetic, there is no risk of an overflow until we reach 64 petabytes. So change to * 200 / (1<<20). Reported-by: Jan Echternach <jan@goneko.de> Resolved-debian-bug: 763917 URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763917 Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: Fix wrong 'goto' in set_new_data_offsetPawel Baldysiak2014-12-021-1/+1
| | | | | | | | | | | | | | Commit a821c95f114724b38df1ea99b2858178e0ed28ce besides introducing additional message, also changed direct return to "goto" instruction. 'goto release' will cause routine to return with '-1', when previously '1' was returned. Described behaviour breaks e.g. IMSM reshape process. This patch fixes this issue by changing 'goto' to proper one - the one that returns '1'. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: don't open md array that doesn't exist.NeilBrown2014-11-251-1/+22
| | | | | | | | | | | | | | Opening a block-special-device for an array that doesn't exist causes that array to be instantiated (as an empty array). Races at array shutdown can cause the array to spontaneously re-appear if some deamon notices a 'change' event and goes to investigate. Teach "mdadm --monitor" to avoid this race by checking the "array_state" before opening the device. Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Makefile: binaries shouldn't directly depend on check_rundirNeilBrown2014-11-251-3/+3
| | | | | | | | | | | | | | check_rundir always needs to be "built", so making mdadm and mdmon depend on it causes them to always be built. i.e. running make ; make will needlessly link the binaries a second time. So change the makefile to use "order-only" pre-requisites. Reported-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: use efivarfs interface for reading UEFI variablesArtur Paszkiewicz2014-11-251-1/+36
| | | | | | | | Read UEFI variables using the new efivarfs interface, fallback to sysfs-efivars if that fails. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: detail-platform improvementsArtur Paszkiewicz2014-11-253-39/+103
| | | | | | | | | | Print platform details per OROM, not per controller, differentiate RST(e) platforms from legacy IMSM, print NVMe device paths, adjust port printing to newer sysfs path. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: add support for NVMe devicesPawel Baldysiak2014-11-253-6/+56
| | | | | | | | Recognize Intel(R) NVMe devices as IMSM-capable. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: support for second and combined AHCI controllers in UEFI modeArtur Paszkiewicz2014-11-251-1/+23
| | | | | | | | | | Grantly platform introduces a second AHCI controller (sSATA) and two new UEFI variables for the RSTe firmware. This patch adds support for those variables in order to correctly determine IMSM platform capabilities in UEFI mode. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: support for OROMs shared by multiple HBAsArtur Paszkiewicz2014-11-253-144/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IMSM platform code was based on an assumption that the OROM or UEFI capability structure (represented by struct imsm_orom) always belongs to only one HBA. This assumption is no longer valid, because of newer platforms with dual AHCI HBAs. Each HBA can have a separate OROM, but some versions have a combined OROM for both HBAs. This patch implements this HBA-OROM relationship in struct orom_entry, which matches an OROM with a list of HBA PCI ids. All the detected orom_entries are stored and retrieved using a global array and the functions add_orom(), add_orom_device_id() and get_orom_by_device_id(). This replaces the arrays: imsm_orom, populated_orom, imsm_efi, populated_efi. The scan() function is extended to find all HBAs for an OROM. The list of their device ids is retrieved from the PCI Expansion ROM Data Structure, hence the additional field devListOffset in struct pciExpDataStructFormat. In UEFI mode we can't read the PCI Expansion ROM Data Structure and the imsm_orom structures are stored in UEFI variables. They do not provide a similar device id list, so we also check the HBA PCI class to make sure that the HBA has RAID mode enabled. In super-intel.c there are changes which allow spanning of IMSM containers over HBAs of the same type, but only if the HBAs share the same OROM. This is done by comparing imsm_orom pointers, which (outside of platform-intel.c) always point to the global array containing all the detected oroms. Additional warnings are added to validate_container_imsm() to warn about potentially dangerous operations in all the possible cases, e.g. when an array is assembled using disks attached to HBAs with separate OROMs. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>