Commit Graph

1055 Commits

Author SHA1 Message Date
Dan Williams df4746577e imsm: fix activate spare to ignore foreign disks
A foreign disk is one that all other drives believe is not-in-sync but
does not have the 'failed' status bit set.

This also reverts, because that commit is addressing the wrong problem.
Ideally mdmon would kick "non-fresh" drives like the kernel does at
native-md activation time, but that is too awkward to implement at the
moment because mdadm owns container manipulations.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-23 23:06:24 -07:00
Dan Williams 7a70e8aa8d imsm: fixup container spare uuids by default
Spares in the imsm case are marked with the "match-all" uuid of
ffffffff-ffffffff-ffffffff-ffffffff.  When performing incremental
assembly we need to associate such devices with a populated container
uuid.  Also when performing --detail on a container with only spares
present we can make an attempt to return a real uuid.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-23 23:06:24 -07:00
Dan Williams 689c9bf3c3 imsm: fix missing initializations of the per-disk extents pointer
Fixes a glibc assertion when trying to free a pointer that was not
malloc'd.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-23 23:06:24 -07:00
Dan Williams ddaf4ce2da test: fix a call to udevsettle
udevsettle is deprecated, use udevadm settle

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-23 23:06:24 -07:00
Dan Williams cceebc67f1 imsm: provide a simulated option-rom for regression tests
IMSM_NO_PLATFORM turns off checks that should be tested, so provide a
IMSM_TEST_OROM variable to allow testing the orom constraints in the
mdadm regression suite.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-23 14:26:10 -07:00
NeilBrown bc8544484f Monitor: send --test message for arrays in /proc/mdstat that aren't in mdadm.conf
"mdadm --monitor --test --scan" currently only sends test messages for
arrays listed on the command line or in /etc/mdadm.conf.  With this
patch it also reports on any active arrays, which is more in line with
the description in the manpage.

Thanks to  Andrew Walrond <andrew@walrond.org> for reporting this error.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-05 17:06:03 +11:00
Dan Williams 5a03814040 imsm: block creation of devices with identical names
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-02 15:01:13 -07:00
Dan Williams 78757ce8a5 imsm: don't check raid1 chunk size
mdadm -C /dev/md/r1d2n1s0-5 -amd -l1  --size 5242880 -n 2 /dev/sdb /dev/sdc  -R -f -v -c 64
mdadm: chunk size ignored for this level
mdadm: super0.90 cannot open /dev/sdb: Device or resource busy
mdadm: super1.x cannot open /dev/sdb: Device or resource busy
mdadm: platform does not support a chunk size of: 0
mdadm: device /dev/sdb not suitable for any style of array

Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Tested-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-02 10:55:31 -07:00
NeilBrown 6c40598f59 Merge branch 'master' into devel-3.0 2009-02-02 11:09:09 +11:00
NeilBrown b47dff6675 Fix possible crash if bitmap metadata is bad.
We really should never divide by 0.

Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net>
for finding the problem.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-02 11:06:38 +11:00
NeilBrown 0083584d5e Document 'max' option to --grow --size in --help output.
Suggestion from Christian Hudon <chrish@debian.org>

Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-02 10:58:08 +11:00
Dustin Kirkland 089485cbe4 Typo in earlier patch : asprintf -> vasprintf
Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-02 10:54:23 +11:00
NeilBrown a123619211 Fix the used device size in mdadm -D output.
As get_component_size() returns the number of used sectors of a device
we need halve before pringing as K, and shift the value by 9, not 10,
before passing to human_size.

Thanks to Andre Noll <maan@systemlinux.org> for identifying problem
(and a slightly different version of this patch)

Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-02 10:03:20 +11:00
Bernhard Reutner-Fischer 2df1f26911 mdadm fix compilation for uClibc
2008-12-08  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>

	* Makefile (dadm.uclibc): Remove misspelled and unneeded rule.
	* md5.h: Include stdint.h for uClibc.
	* mdadm.h: uClibc defines __UCLIBC__. If uClibc has LFS off
	then use lseek instead of lseek64.

Signed-off-by:  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>
2009-02-02 09:53:51 +11:00
Dan Williams caf8d23175 imsm: fix failed disks are allowed back into the container
Failed disks do not have valid serial numbers which means we will not
pick up the 'failed' status bit from the metadata entry.  Check for
dl->index == -2 to prevent failed disks from being incorporated into the
container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-23 15:45:34 -07:00
Dan Williams 5615172f1d Create: warn when a metadata format's platform components are missing
If the metadata handler can not find its platform support components
then there is no way for it to verify that the raid configuration will
be supported by the option-rom.  Provide a generic method for metadata
handlers to warn the user that the array they are about to create may
not work as intended with a given platform.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:51 -07:00
Dan Williams a20d2ba5f3 imsm: enforce "all member disks must be members of all arrays"
This is a key orom-compatibility constraint.  A nice side effect is that
it precludes the corner case of 'create' racing against 'spare activate'
since the create will fail to convert a spare into an array member.  At
create time we check if this is the first member array in the container
if it is than all disks are possible candidates, if it is not then only
current members are permitted.

A bit hairier is spare-activation handling in the presence of this
constraint.  It is difficult because spare handling is per array.  The
approach taken is to:

1/ check that a new spare can cover all defined arrays in the container
2/ ensure that partially assimilated spares are the first candidates
   when looking for a spare region to activate.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:51 -07:00
Dan Williams 1c556e92ba imsm: enforce num_disks constraints
RAID1 == 2 disks
RAID5 >= 3 disks
RAID10 == 4 disks

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 35f81cbbc5 imsm: rename vprintf macro to pr_vrb
Don't redefine standard library calls unecessarily...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams a18a888ea7 Create: allow per-metadata default layouts
Let handlers specifiy their own defaults, specifically needed for the
imsm-raid5 case where mdadm defaults to 'ls' and imsm to 'la'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 5746141e3f mdmon: make switchroot an undecorated option
Simplify the usage from:
	mdmon [--switch-root dir] /device/name/for/container
to...
	mdmon /device/name/for/container [target_dir]

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 66afdfa977 Assemble: fix busy detection
Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays.

Ran into this after an encountering a case where mdadm -Ss ended in
segfault (missing check for NULL return from map_by_devnum() in
sles11:Manage.c).  So, tried to stop the array by hand with echo clear >
md/array_state, after which I could not reassemble since GET_ARRAY_INFO
was succeeding.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 1ffd2840df mdmon: support scanning for containers
When the given container is '/proc/mdstat' then launch an mdmon instance
per container found in /proc/mdstat.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 6f4098a6fd mdmon: expand permissible container device names
Allow any path that dereferences to an md device to be used in addition
to the current symbolic md device names.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
Dan Williams 03cd4cc810 imsm: imsm_read_serial check for zero-length response
VMWare virtual disks successfully run the inquiry but return a zero response.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:33:56 -07:00
Dan Williams be2c0e387b imsm: fix dev_open return value handling
dev_open returns an fd

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 00:29:34 -07:00
Dan Williams c1363b408f mdmon: fix missing ->subarray initialization
This can cause mdmon to fail at startup.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-13 15:46:05 -07:00
NeilBrown 78fbcc1031 Merge branch 'master' into scratch-3.0
Conflicts:

	Assemble.c
	config.c
2009-01-08 09:31:28 +11:00
Dustin Kirkland 1a0ee0baf0 Fail overtly when asprintf fails to allocate memory
.. rather that causing a less-obvious violation of segments.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-01-08 09:25:33 +11:00
NeilBrown 89a10d84cb Free mdstat data structures properly.
In one case we called 'free' instead of 'mdstat_free'.
In others we didn't free at all.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-01-08 09:25:31 +11:00
NeilBrown 45b662b611 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-12-18 16:58:25 +11:00
NeilBrown 8a659c3321 Merge branch 'master' into devel-3.0
Conflicts:

	Assemble.c
	Incremental.c
	Kill.c
	ReadMe.c
	inventory
	mapfile.c
	mdadm.8
	mdadm.spec
	mdassemble.8
2008-12-18 16:56:13 +11:00
NeilBrown 3a56f223e9 map: rebuild map if it doesn't exist.
It is possible for some arrays to be created e.g. by initrd, and so
not get mentioned in /var/run/mdadm/map.
As "-I" depends on things being listed in 'map', we create it by
scanning all devices if it doesn't exist.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 16:23:46 +11:00
NeilBrown acee8e8964 Assemble: set stripe_cache_size properly when restarting a reshape.
Reshape with large chunk size can require a large stripe_cache.
We make this work when starting the reshape but not when
restarting at assemble time.  So fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 14:24:41 +11:00
NeilBrown 4e9a6ff778 Assemble: don't assume array is 'clean' unless all devices think it is.
This is only significant for --assemble --force where some old
devices might be included into the array.  If anything looks like
it isn't clean, the kernel will not allow a degraded array to be started.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 14:11:59 +11:00
NeilBrown 22eba51216 Kill: Don't use O_EXCL when --force is used.
We really want --zero-super --force to zero the superblock in
all situations.  So don't open with O_EXCL - trust the user.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 14:04:45 +11:00
Dan Williams 0c5c7b470e imsm: test overlapping creates
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:19 -07:00
Dan Williams 2952742d32 workaround a hald interaction and quiet cleanup
The 'udevadm settle' call appears to resolve:

mdadm: failed to stop array /dev/md127: Device or resource busy
Perhaps a running process, mounted filesystem or active volume group?

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 4b7a9ee3a1 test: enable per-test custom environment setup/teardown
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 4025c288b2 imsm: don't take chunk_size into account for raid1
Results in chopping off usable parts of the requested size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams c8151cbc42 imsm: reverse swapped arguments to posix_memalign in imsm_prepare_update
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams ba2de7ba05 imsm: convert dev_tbl to devlist
...to facilitate testing arbitrary numbers of raid devices

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams d665cc31e7 imsm: provide a detail_platform method
Dump the orom capabilities and hardware disk configuration.  This code
relies on the name of scsi_host objects to determine the hardware port
number.  Hopefully this information is stable...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 4cce406959 introduce --detail-platform to display platform raid capabilities
Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 88c32bb1ec imsm: validate arrays being created against firmware capabilities
These checks are only enabled when platform support for imsm is found,
i.e. ahci driver is loaded and talking to an Intel(R) controller, and
the option rom header is located.

They can be turned off by setting the environment variable
IMSM_NO_PLATFORM to 1.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 25921536da imsm: sysfs support routines for determining device connectivity
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams b390f61061 imsm: detect option-rom capabilities
The option-rom advertises its capabilities in a data structure located in
the platform ROM region 0xc0000-0xf0000.  Attempt to detect the option-rom
and limit array creation to the platform's capabilities.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 39795f9cda port arch/x86/kernel/probe_roms_32.c for use in 'platform' support
This provides at least a kernel bug compatible method of scanning for an
adapter-rom.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
Dan Williams 54c2c1ea23 imsm: pass disk info in create message
We may be creating on spare disks in which case we need to know which
disk goes in which slot.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:17 -07:00
Dan Williams 0dcecb2e2d imsm: correct start offset handling at create time
imsm metadata requires all members of a raid volume to start at the same
offset.  So, incrementally build a composite disk from all the
candidates passed to ->validate_geometry.  After each disk is added
merge the extents and search for a common start offset that satisfies
the requested raid device size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:17 -07:00