Commit Graph

2953 Commits

Author SHA1 Message Date
Samuli Suominen 47c4331d1f Fix parallel make problem.
When make is called with, for example,
   "make -j9 install install-system"
i.e. both install and install-systemd targets at the same
line and with high -j value,
then the same install.tmp file was used, and udev rules
ends up in systemd service files, or otherway around.

For more information, see:
  http://www.spinics.net/lists/raid/msg46782.html
  http://bugs.gentoo.org/show_bug.cgi?id=517218

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-21 15:00:29 +10:00
NeilBrown 6ac17e734b super1: make sure 'room' includes 'bbl_size' when creating array.
Because we then go ahead and subtrace bbl_size from room.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-21 10:57:55 +10:00
NeilBrown 268cccac2e super1: don't allow adding a bitmap if there is no space.
If the data is too close to the superblock there may be
no space for a bitmap.
If that happens, fail the adding of the bitmap rather than
corrupt data.

Reported-by:  Lars Wijtemans <rhelbugzilla@lars.wijtemans.nl>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=922944
2014-08-15 15:45:54 +10:00
NeilBrown 73ff073271 Monitor: Stop monitoring devices that have disappeared.
If we are only monitoring a device because we found it in
/proc/mdstat, and it has been gone for 5 checks, forget
about it completely.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-14 15:36:09 +10:00
NeilBrown f66585eb08 mdadm: document some more magic environment variables.
Others are mostly for developers.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-14 14:54:05 +10:00
NeilBrown b47024f1c5 Manage: fix removal of non-existent devices.
"--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>
2014-08-11 10:34:41 +10:00
NeilBrown cc742d3807 util: split get_maj_min() out from dev_open()
This allows other code to parse "8:3" style device names.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-11 10:34:36 +10:00
NeilBrown 5dffd09d24 Manage: simplify `rdev` handling in Manage_subdevs.
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>
2014-08-11 10:22:24 +10:00
NeilBrown e2efe9e7bc config: new option to suppress adding bad block lists.
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>
2014-08-07 12:23:45 +10:00
NeilBrown 968d2a336e md.4: replace "bad block log" with "bad block list"
Elsewhere we use the term "list", and it is more accurate.
Logs are usually append-only.  This list isn't.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-07 12:22:41 +10:00
NeilBrown 935a32543e mdmon: don't include super0 and super1 in mdmon
They are no needed, and future patch will add a dependency
yo super1 which mdmon doesn't have.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-07 12:14:49 +10:00
NeilBrown f4dc5e9b7f super: make sure to ignore disk state flags that we don't understand.
This make it easier to add new flags that some super-types
don't understand.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-08-07 11:34:50 +10:00
NeilBrown c9f1cbc050 Detail: Avoid dereferencing some NULL pointers.
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>
2014-08-06 15:56:12 +10:00
Guy Menanteau d13566f9b6 DDF: cast print arguments in super-ddf.c
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>
2014-08-05 08:57:48 +10:00
NeilBrown 5141638c54 Assemble: Only fail auto-assemble in face of mdadm.conf conflicts.
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>
2014-07-29 13:48:23 +10:00
NeilBrown 46643e1ad5 Grow: improve error message is "--grow -n2" used on Linear arrays.
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>
2014-07-29 13:37:42 +10:00
NeilBrown 4e9a3dd16d Grow: fix that preventing resize of array to 32bit size.
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>
2014-07-21 16:51:53 +10:00
Pawel Baldysiak d31ad6439e IMSM: move "validate_container_imsm" to be included in mdassemble
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>
2014-07-21 16:50:19 +10:00
Pawel Baldysiak 13ffbe89b6 Grow: Do not try to restart if reshape is running
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>
2014-07-17 14:08:24 +10:00
NeilBrown 095b8088fa IMSM: validate metadata_update size before using it.
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>
2014-07-10 16:10:23 +10:00
NeilBrown 1f17f96b53 DDF: validate metadata_update size before using it.
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>
2014-07-10 15:59:06 +10:00
NeilBrown 5fe6f031d9 mdmon: allow prepare_update to report failure.
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>
2014-07-10 15:54:02 +10:00
Pawel Baldysiak 0c21b485e4 IMSM: Add warning message when assemble spanned container
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>
2014-07-08 11:39:23 +10:00
NeilBrown 120ec6f7b9 mdmon: ensure Unix domain socket is created with safe permissions.
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>
2014-07-03 17:06:45 +10:00
NeilBrown f99a9e1563 md.4: Make tables narrow enough to fit.
If we use "Dev" instead of "Device" on the wide tables,
they fit better.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-07-03 16:49:15 +10:00
Christoph Anton Mitterer 8dc92b41ac revised the documentation of RAID10 layouts
* 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>
2014-07-03 16:46:49 +10:00
NeilBrown 6ffdbec6e2 Makefile: use "man -l" to format man pages.
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>
2014-07-03 16:46:43 +10:00
NeilBrown 0de5349e7f mdadm.8: Fix typo in setting font.
\fP returns to previous font, not \fp.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-07-03 15:06:17 +10:00
NeilBrown 47120ad5d7 mdadm.8: Fix typo in "no-bbl".
The '\' comes before the '-', not after!

Signed-off-by: NeilBrown <neilb@suse.de>
2014-07-03 15:05:35 +10:00
NeilBrown 6d8d290a2f IMSM: use strcpy rather than pointless strncpy.
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>
2014-07-03 15:04:01 +10:00
Pawel Baldysiak e339dba2a1 Grow: fix removal of line in wrong case
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>
2014-06-12 17:32:21 +10:00
NeilBrown 616f197f9d Makefile: install mdadm-grow-continue@.service
Forgot to add this to install-systemd target

Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-10 20:34:40 +10:00
NeilBrown 9275a5ec59 Release mdadm-3.3.1
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 16:54:24 +10:00
NeilBrown 1e60caebbc Make sure "make everything" builds again.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 16:38:29 +10:00
NeilBrown 02b70e83e6 Incremental: remove old devices when assembling in container.
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>
2014-06-05 15:58:31 +10:00
Artur Paszkiewicz 8a3544f895 imsm: retry load_and_parse_mpb if we suspect mdmon has made modifications
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>
2014-06-03 09:09:41 +10:00
Baldysiak, Pawel 40b941b813 Grow: Do not fork via systemd if freeze_reshape is set
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>
2014-06-02 12:42:01 +10:00
Baldysiak, Pawel 054cba7719 Grow: Use 'forked' also for reshape_container in Grow_continue
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>
2014-06-02 12:39:14 +10:00
Baldysiak, Pawel 18d9bcfa33 Do not set default 'before.layout' when reshaping from RAID4 to RAID4
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>
2014-06-02 12:29:37 +10:00
NeilBrown 868ab80dea mdcheck: don't pass the '+' to "date".
It isn't needed, makes is harder to describe what --duration does.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-26 09:37:05 +10:00
NeilBrown 20d430ca81 DDF: remove "BVD xx is missing".
This can happen in normal cases during incremental assembly so
printing an error message is confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 17:22:47 +10:00
NeilBrown 85945e1986 install: use BINDIR consistently to locate mdadm and mdmon
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>
2014-05-22 17:13:02 +10:00
NeilBrown df881f757b mdcheck: new script to help with regular checks of md arrays.
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>
2014-05-22 16:00:39 +10:00
NeilBrown a740cf6432 MISC: add --action option to set or abort check/repair.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 15:55:31 +10:00
NeilBrown 1e781e07ab --examine-bitmap: give useful message if no bitmap found on md array.
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>
2014-05-22 15:22:39 +10:00
Cristian Rodríguez 04f903b21a mdadm: Do not reimplment offsetof
Proper implementations have offsetof in stddef.h

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 14:29:14 +10:00
NeilBrown 06e293d097 Grow: fix resent grow_continue breakage.
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>
2014-05-22 14:22:58 +10:00
NeilBrown 2ecda5a3fa DDF: remove some pointless code in validate_geometry
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>
2014-05-21 14:03:48 +10:00
NeilBrown 3d99ecd7b5 DDF: remove a FIXME comment that doesn't seem to mean anything.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:51:33 +10:00
NeilBrown 98fbc0ff37 DDF: remove 'FIXME' comment that doesn't need fixing.
It appears this is correct, though for consistency with elsewhere
we check that pdnum is not negative.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:50:52 +10:00