Commit Graph

1087 Commits

Author SHA1 Message Date
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
Dan Williams 03bcbc654f imsm: fix setting of device size for raid1
When chunksize is 0 in the raid1 case we need to use
info_to_blocks_per_member() to calculate the array size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:17 -07:00
Dan Williams 959278735e wait_for container assembly
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:17 -07:00
NeilBrown b06e30958b DDF: improve --examine output
Make this more readable and in line with other
metadata types by providing a table for the devices.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 17:10:43 +11:00
NeilBrown 8592f29d64 Create: support autolayout when creating in a DDF
If, when creating an array, a signal target device is given which
is a container, then allow the metadata handler to choose which
devices to use.
This is currently only supported for DDF.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 16:08:33 +11:00
NeilBrown e46273ebe4 Change 'size' argument to validate_geometry to be sectors, not K
That way it is the same a *freesize, and generally less confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-04 15:47:57 +11:00
Dan Williams e7783ee677 fix ->metadata_version checking in Wait()
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-02 22:45:43 -07:00
NeilBrown 504fb2e7f3 Allow --config in --incremental mode. 2008-12-01 11:21:27 +11:00
NeilBrown ed034b1170 Create: print message when preparing a container.
We currently print e.g. "Array /dev/md0 started", but nothing for
containers.
Fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-28 13:59:36 +11:00
NeilBrown ca01c83be5 Release 2.6.8 2008-11-28 12:14:57 +11:00
NeilBrown 0e69da729d Fix typo in mdadm.conf.5
Debian Bug #506245

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-28 11:52:16 +11:00
Dan Williams 900968e382 fix add_dev() handling of broken links
Resolves issues like:
mdadm -Ss
mdadm: unable to open /dev/md/r1: No such file or directory

...where /dev/md/r1 points to a removed device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-28 11:30:02 +11:00
NeilBrown 5a52a34090 Merge branch 'master' into devel-3.0 2008-11-27 15:48:45 +11:00
NeilBrown d555f10146 Assemble: allow --force to work even when event counts are 0.
If any superblocks in a confused array had an event count of 0,
"mdadm -Af" would not update the event counts to assemble the array.
I don't remember why that text is there, and it has caused at least
one situation to be difficult to recover from.  So remove the
test.  --force means --force!

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-27 15:46:51 +11:00
NeilBrown 78b958e205 Assemble: wait for device to appear via udev
Use the new "wait_for" function to make sure udev has created
the device before completion the 'assemble'.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-27 15:43:22 +11:00
Dan Williams dda5855f96 imsm: fix metadata reservation
1/ When truncating the space reserved for the metadata round down to an
   even numbered sector count to avoid an off-by-one error when
   sysfs_add_disk rounds up.
2/ Set the current metadata parameter block size
   as a floor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:41:03 +11:00
NeilBrown 208933a7a8 Tidy error messages for add_to_super failure.
Make sure every failure from add_to_super prints a suitable
error message, and then don't print any error in the caller.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-27 15:39:59 +11:00
Dan Williams f20c396836 allow add_to_super to return errors
Prepare add_to_super to validate disks against the platform capabilities

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:30:39 +11:00
Dan Williams fabbfd48b6 Support --wait-clean --scan
Its cumbersome to determine which devices to wait for in a system shutdown
script, so hook up --scan.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:30:21 +11:00