"--remove detached" and others stopped working a while
back when I refactored some code.
For 'remove' and 'fail', the device may not exist so
if it is "MM:mm", (e.g. added by "detached"), just parse
out the numbers.
Reported-by: Killian De Volder <killian.de.volder@megasoft.be>
Signed-off-by: NeilBrown <neilb@suse.de>
The only use 'struct stat stb' to get the 'rdev', and sometimes
we don't even use 'stat'.
So make 'rdev' a stand-alone variable, and only declare stb'
when we actually need it.
Signed-off-by: NeilBrown <neilb@suse.de>
CREATE bbl=no
in mdadm.conf will cause any devices added to an array
to not have a bad block list. By default they do for 1.x
metadata.
This is useful if you are suspicious of the bad-block-list
implementation.
Reported-by: Ethan Wilson <ethan.wilson@shiftmail.org>
Signed-off-by: NeilBrown <neilb@suse.de>
dm devices which only have a single underlying md device
will respond to md ioctls as though they were that md device.
This can confuse mdadm and lead it to violating its segments.
So add tests for NULL where appropriate. You might not get exactly
the right answer when you "mdadm -D" a dm device, but at least it won't
crash now.
Reported-by: Willy Weisz <Willy.Weisz@univie.ac.at>
Resolves: https://bugzilla.novell.com/show_bug.cgi?id=887821
Signed-off-by: NeilBrown <neilb@suse.de>
mdadm fails to build on ppc64 and ppc64le architectures.
===
super-ddf.c: In function '_set_config_size':
super-ddf.c:2849:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=]
pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n",
^
super-ddf.c:2855:2: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=]
dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n",
^
cc1: all warnings being treated as errors
<builtin>: recipe for target 'super-ddf.o' failed
===
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1125883
Signed-off-by: <menantea@linux.vnet.ibm.com>
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
Signed-off-by: NeilBrown <neilb@suse.de>
We should never auto-assemble things that conflict with mdadm.conf
However explicit assembly requests should be allowed.
Reported-by: olovopb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1070245
Signed-off-by: NeilBrown <neilb@suse.de>
Linear arrays don't respond to setting raid-disks, only to
adding a device.
Reported-by: mulhern
Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1122146
Signed-off-by: NeilBrown <neilb@suse.de>
If the request --size to --grow an array to is 32bits
(i.e. msb in bit 32) then mdadm make wrong choice and
uses ioctl instead of setting component_size via sysfs
and the change is ignored.
This is fixed by using correct casts.
Reported-and-tested-by: Killian De Volder <killian.de.volder@megasoft.be>
Signed-off-by: NeilBrown <neilb@suse.de>
Commit 0c21b485e4 added new
function in imsm superswitch. This function should be
included in mdassemble.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Grow process did not check if reshape is already started
when deciding about restarting.
Sync_action should be checked in this case, and if
reshape is running - restart flag should not be set.
Otherwise, Grow process will fail to write data to
sysfs, and reshape will not be continued.
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>
Every case in prepare_update check that the size message
size is sufficient, so process_update doesn't need to check anything.
Reported-by: Vincent Berg <vberg@ioactive.com>
Signed-off-by: NeilBrown <neilb@suse.de>
process_update already checks update->len, for all but
the 'magic', prepare_update doesn't at all.
So add tests to prepare_update that we don't exceed the buffer.
This will consequently protect process_update from looking
for a 'magic' which isn't there.
Reported-by: Vincent Berg <vberg@ioactive.com>
Signed-off-by: NeilBrown <neilb@suse.de>
If 'prepare_update' fails for some reason there is little
point continuing on to 'process_update'.
For now only malloc failures are caught, but other failures
will be considered in future.
Signed-off-by: NeilBrown <neilb@suse.de>
Due to several changes in code assemble with disks
spanned between different controllers can be obtained
in some cases. After IMSM container will be assembled, check HBA of
disks, and print proper warning if mismatch is detected.
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>
In the unlikely case that mdmon is started with an overly
permissive umask, we don't want to risk giving away world acccess.
All other "mkdir" and "O_CREAT" calls in mdmon and mdadm set
a suitably restrictive permission mask. 'bind' don't take an
explicit mask so it needs an implicit one.
Reported-by: Vincent Berg <vberg@ioactive.com>
Signed-off-by: NeilBrown <neilb@suse.de>
* Completely revised the documentation of the RAID10 layouts, with examples for
n2,f2,o2 with and odd and an even number of underlying devices.
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Signed-off-by: NeilBrown <neilb@suse.de>
Formatting a man page is more than just "nroff -man".
In particular, that doesn't invoke "tbl" when needed.
So use "man -l" which performs correct formatting on a
given file.
Signed-off-by: NeilBrown <neilb@suse.de>
As strncpy doesn't guarantee to nul-terminate, some static
analysers get upset that it is followed by a 'strncat'.
So just use a 'strcpy' - strlen(disk_by_path) is constant
and definitely less than PATH_MAX.
Link: https://github.com/neilbrown/mdadm/issues/4
Signed-off-by: NeilBrown <neilb@suse.de>
Commit 18d9bcfa33
removed wrong line (in case RAID0->RAID4).
This patch corrects this mistake
(line should be removed in case RAID4->RAID4).
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
When assembling a native array we just give all devices to the kernel
and leave it to discard the 'old' ones (based on sequence/event
number).
For external/container arrays, mdadm needs to do that.
So in assemble_container_content, get list of current devices in
array and discard any that aren't in the 'content' given.
They must have been rejected by metadata manager.
If we cannot discard old devices the array must already be active, so
just leave it alone, but with a message.
Signed-off-by: NeilBrown <neilb@suse.de>
If the checksum verification fails in mdadm and mdmon is running, retry
the load to get a consistent snapshot of the mpb.
Based on db575f3b
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Mdadm should not run 'grow-continue' unit file for container if
'--freeze-reshape' argument is passed. Otherwise it will be ignored,
and reshape will start anyway.
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Similar to commit 06e293d097
same thing should be done for reshape_container in Grow_continue
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Commit fdcad551e9
brings some changes to reshape process.
Setting 'before.layout' when reshaping from RAID4 to another RAID4 is
not really necessary.
If reshape is restarted 'before.layout' will be compared with
'info->array.layout' in reshape_array(). Changes brought by mentioned
commit will cause this comparation return as false, becouse 'array.layout'
is always set to 'ALGORITHM_PARITY_N' in analyse_change() for RAID4, so
reshape will not be continued after reboot/stop.
This patch reverts unnecessary changes.
Signed-off-by: Pawel Baldysiak pawel.baldysiak@intel.com
Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Every place where the paths for mdadm or mdmon is explicit,
it should use the BINDIR setting, not "/sbin/".
Reported-by: member graysky <graysky@archlinux.us> (https://bugs.archlinux.org/task/37330)
Signed-off-by: NeilBrown <neilb@suse.de>
This script allows arrays to be 'checked' for a limited amount
of time on a regular basis.
For example, running
mdcheck --duration 6hours
early every Sunday morning and
mdcheck --continue 6hours
ever other morning will check all arrays every week, but if that take
more than 6 hours, will won't run into the day, but will be continued
the next morning, and the next ... etc.
Signed-off-by: NeilBrown <neilb@suse.de>
The bitmap is stored on member devices, not on the array, so
--examine-bitmap should be given the member device.
If --examine-bitmap is given an array, and it doesn't have a bitmap
on it (i.e. it isn't a member of some other array), then that
is probably a usage error, so print a helpful message.
Signed-off-by: NeilBrown <neilb@suse.de>
Commit 5e76dce1ac changed
Grow_continue to assume a fork had already happened, so that
mdadm --grow --continue
didn't fork. This is good, but it means that if Grow_continue
is run from Assemble, then
mdadm --assemble ....
can misbehave if the array was in the middle of a reshape.
So introduce finer control. Grow_continue only assumes it has
already forked if run from "mdadm --grow --continue".
Signed-off-by: NeilBrown <neilb@suse.de>
I'm not sure what this was supposed to do, but it isn't needed
as creating on a container and on individual devices (in a container)
work fine already.
Signed-off-by: NeilBrown <neilb@suse.de>
As this code runs in 'monitor' it cannot just free memory,
it must add it to a list for 'manager' to free.
Fortunate update->space_list exists for just this purpose.
dl->devname might be small, so put it in update->space and
put dl in update->space_list.
Signed-off-by: NeilBrown <neilb@suse.de>