summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Reuse calc_bitmap_size to reduce code sizeclusterGuoqing Jiang2015-06-171-10/+2
| | | | | | | | We can use the new added calc_bitmap_size func to remove some redundant lines. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: change the num of cluster nodeGuoqing Jiang2015-06-176-2/+54
| | | | | | | | | | | | This extends nodes option for assemble mode, make the num of cluster node could be change by user. Before that, it is necessary to ensure there are enough space for those nodes, calc_bitmap_size is introduced to calculate the bitmap size of each node. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: add the ability to change cluster nameGuoqing Jiang2015-06-177-8/+44
| | | | | | | | | | | | To support change the cluster name, the commit do the followings: 1. extend original write_bitmap function for new scenario. 2. add the scenarion to handle the modification of cluster's name in write_bitmap1. 3. let the cluster name also show in examine_super1 and detail_super1 Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Skip clustered devices in incrementalGuoqing Jiang2015-06-172-0/+7
| | | | | | | | | | | We want the clustered devices to be started exclusively by a cluster resource-agent. So, avoid starting using the incremental option. This also skips a clustered md from starting during boot in inactive mode. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Convert a bitmap=none device to clusteredGuoqing Jiang2015-06-171-3/+7
| | | | | | | | | | | | | This adds the ability to convert a regular md without bitmap (--bitmap=none) to a clustered device (--bitmap=clustered). To convert a device with --bitmap=internal or --bitmap=external, you have to convert to --bitmap=none and then re-execute the command with --bitmap=clustered. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add a new clustered diskGuoqing Jiang2015-06-178-3/+68
| | | | | | | | | | | | | | | | | | A clustered disk is added by the traditional --add sequence. However, other nodes need to acknowledge that they can "see" the device. This is done by --cluster-confirm: --cluster-confirm SLOTNUM:/dev/whatever (if disk is found) or --cluster-confirm SLOTNUM:missing (if disk is not found) The node initiating the --add, has the disk state tagged with MD_DISK_CLUSTER_ADD and the one confirming tag the disk with MD_DISK_CANDIDATE. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Show all bitmaps while examining bitmapGuoqing Jiang2015-06-171-9/+42
| | | | | | | | | This adds capability of exmining bitmaps corresponding to all nodes/slots on the device. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Set home-cluster while creating an arrayGuoqing Jiang2015-06-179-3/+122
| | | | | | | | | | | | | | | The home-cluster is stored in the bitmap super block of the array. The device can be assembled on a cluster with the cluster name same as the one recorded in the bitmap. If home-cluster is not specified, this is auto-detected using dlopen corosync cmap library. neilb: allow code to compile when corosync-devel is not installed. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add nodes option while creating mdGuoqing Jiang2015-06-176-1/+44
| | | | | | | | | | Specifies the maximum number of nodes in the cluster that may use this device simultaneously. This is equivalent to the number of bitmaps created in the internal superblock (patches to follow). Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create n bitmaps for clustered modeGuoqing Jiang2015-06-175-23/+49
| | | | | | | | | | | | | | | | | | | | | | | For a clustered MD, create bitmaps equal to number of nodes so each node has an independent bitmap. Only the first bitmap is has the bits set so that the first node that assembles the device also performs the sync. The bitmaps are aligned to 4k boundaries. On-disk format: 0 4k 8k 12k ------------------------------------------------------------------- | idle | md super | bm super [0] + bits | | bm bits[0, contd] | bm super[1] + bits | bm bits[1, contd] | | bm super[2] + bits | bm bits [2, contd] | bm super[3] + bits | | bm bits [3, contd] | | | Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix a couple of typos.NeilBrown2015-05-281-2/+2
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* test: make 'check wait' more reliable.NeilBrown2015-05-281-1/+1
| | | | | | | | | | | 'recover' etc doesn't appear in /proc/mdstat immediately. The "sync" thread must be started first. But 'sync_action' shows it as soon as MD_RECOVERY_NEEDED is set in the kernel. So look there too. Now maybe I can get rid of some of those silly 'sleep' calls. Signed-off-by: NeilBrown <neilb@suse.de>
* tests/imsm-grow-template change 'wait' to 'check wait'NeilBrown2015-05-283-8/+6
| | | | | | | 'wait' is a shell builtin that isn't doing anything useful. It should be calling 'check wait' I think. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix problem with --grow --continueNeilBrown2015-05-281-3/+4
| | | | | | | | | | | | | | If an array is being reshaped using backup space on a 'spare' device, then mdadm --grow --continue won't find it as by the time it runs, nothing looks like a spare are more. The spare has been added to the array, but has no data yet. So allow reshape_prepare_fdlist to find a newly-incorporated spare and report this so it can be used. Reported-by: Xiao Ni <xni@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* tests: wait a bit long for reshape to complete.NeilBrown2015-05-252-2/+4
| | | | | | | As the kernel now does less locking, 'check wait' doesn't always wait long enough. Add some pauses. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: another attempt to fix stop-during-reshape race.NeilBrown2015-05-251-16/+18
| | | | | | | | | | | When the array is stopped during a critical section, we sometimes erase the backup, which is bad. This happens when 'completed' is zero. This can happen easily when 'stop' freezes reshape. So try to be more careful and check 'reshape_position'. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix minor typo in mdadm manpage.Andrew Burgess2015-05-231-1/+1
| | | | | | | | | | | Appologies if this is the wrong mailing list for this patch. This is a very small patch for the manual page for the mdadm utility. Thanks, Andrew Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: monitor: fix nullptr dereference when get_md_name() returns NULLSergey Vidishev2015-05-201-1/+9
| | | | | | | | | Function add_new_arrays() expects that function get_md_name() should return pointer to devname, but also get_md_name() may return NULL. So check the pointer before use it in add_new_arrays(). Signed-off-by: Sergey Vidishev <sergeyv@yandex-team.ru> Signed-off-by: NeilBrown <neilb@suse.de>
* test: forcefully clean up old loop devices.NeilBrown2015-05-201-0/+8
| | | | | | | | sometimes these can get left around, and udev can be looking at them at awkward times so they don't disappear. So be forceful. Signed-off-by: NeilBrown <neilb@suse.de>
* 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>