Commit Graph

1027 Commits

Author SHA1 Message Date
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
Dan Williams 614825ea82 some warn_unused_result fixups
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-27 15:29:54 +11:00
NeilBrown a30b2ecd4a Assemble: don't auto-assemble if any arrays are listed in mdadm.conf
Auto-assembly and planned assembly don't really work well together,
it can be confusing.
In particular in mkinitrd or similar creates an mdadm.conf to
assemble a particular array, we shouldn't go assembling any
other arrays as well.

If you want auto assembly, you need to give mdadm a config
file with no ARRAY lines.
  mdadm -Ascpartitions
can do this.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-20 17:02:55 +11:00
NeilBrown e8a70c8958 mdmon: pass symbolic name to mdmon instead of device name.
Now that names in /dev are usually created (eventually) by udev,
it isn't really safe to rely in finding a name in /dev to pass to
mdmon to identify which array to monitor.
And it isn't really necessary to have a name in /dev.
So just pass the symbolic name, e.g. md127 or md123.

Change util.c to pass that name, and change mdmon to process the
name sensibly.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-20 14:51:42 +11:00
Dan Williams bf68e9d9ab 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-10 09:30:07 -07:00
Dan Williams ef70b9f4ef fix remove_devices()
Don't write to 'pe' if 'path' was not specified

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-08 16:03:07 -07:00
Dan Williams 92bd8f8d3f imsm: fix uuid_from_super given 'signature' is not constant
The version portion of the signature changes depending on the contents
of the container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-08 16:03:07 -07:00
Dan Williams 4d1313e901 imsm: compatibility fixes for creating imsm arrays
When creating an imsm array use the lowest possible feature set to
maximize compatibility.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-08 16:03:07 -07:00
Dan Williams f2f27e63c4 imsm: fixup disk status definition endianess
Change the multibyte disk status field definitions to imsm byte-order
(little-endian) to match other multibyte field definitions.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-08 16:02:56 -07:00
Dan Williams fe7ed8cb4f imsm: add definitions for recent imsm versions
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-08 15:47:39 -07:00
Dan Williams e3bba0e010 imsm: cleanup migration definitions and usage
imsm_set_array_state need not look at the map_state when failed==0

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-07 15:57:31 -07:00