Commit Graph

1057 Commits

Author SHA1 Message Date
NeilBrown 8b4e5ea926 Assemble: call map_update even when not starting the array.
For incremental assembly to work, we need to keep the 'map'
up-to-date even when not starting the array yet.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:45:42 +10:00
NeilBrown c0d50ca584 ddf: fixed 'working_disks' reported by container_content.
The 'work_disks' number should be the number that is expected, not the
number found so far.   This is needed for Incremental assembly to
start the array at the right time.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:41:55 +10:00
NeilBrown 962371a529 ddf: improve print out of physical devices.
Just add some more space really.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:40:24 +10:00
NeilBrown e223334fe7 ddf: fix variable name overload
The variable 'i' was being used as a loop variable, and also
for something else inside the loop.   So make the larger loop have a
more meaningful name.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:38:25 +10:00
NeilBrown a7c6e3fb24 wait_for improvement.
wait not only for the name to appear, but for it to refer to the
correct device.
Sometimes old symlinks left lying around can be confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:34:38 +10:00
NeilBrown b1b12d5819 config: treat "container=" and "member=" and providing the required identity information.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-06 16:09:52 +10:00
NeilBrown 3590496027 Detail: use meaningful names with --scan.
When reporting "--detail --scan", use names like /dev/md/foo where
available rather than /dev/md/127

This is particularly needed for containers where the member arrays
will report "container=/dev/md/foo" and we want the container to have
the same name.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-06 15:54:51 +10:00
NeilBrown 9f3bd60c79 Create: round to chunk size
There are probably other places where rounding size to
chunksize is needed, or useful, but this is a good start.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-06 15:53:31 +10:00
NeilBrown d50683f903 test: support testing DDF
DDF requires larger devices as 32Meg is reserved.

So allocated larger loop devices for DDF tests.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-06 15:52:13 +10:00
NeilBrown a56fb7ec54 util.c: use correct range for minor numbers when finding free device.
Minor numbers are 20 bits, not 22.
So when looking for a free, high minor number, try (1<<20)-1,
not (1<<22)-1.
2009-04-06 15:50:56 +10:00
NeilBrown ea17e7aa30 ddf: make sure Create fails if devices are too small.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-02 14:02:33 +11:00
NeilBrown 97320d7ca4 ddf: fix bug with error returns.
In some cases we should only print an error message if
'devname' is defined.  In fact we were only returning
the error at all in that case!!

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-02 13:37:34 +11:00
NeilBrown 37353437da ism-tests: fix the imsm-create-fail-rebuild test
it was testing the return status of mdadm wrongly, and
I found I needed a 'udevadm settle'.
2009-04-01 13:51:57 +11:00
NeilBrown dd4ae23ad0 test: return correct error status for mdadm
mdadm's return status is being hidden by the 'test' script so
individual tests cannot see it.
2009-04-01 13:50:19 +11:00
NeilBrown 55e5475945 Makefile: build 'mdmon' for 'test'
Else
  make test
might not prepare everything for running tests.
2009-04-01 13:49:34 +11:00
NeilBrown 93ecfa01d4 grow: don't wait forever for critical section to pass.
If an array reshape completed within 1 second, then --grow will not
notice that it has finished and will keep waiting for the critical
section to pass.

So be more cautious in the test.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-01 12:26:08 +11:00
NeilBrown b9d77223eb Release mdadm-3.0-devel3 2009-03-10 16:59:57 +11:00
NeilBrown 8844e29149 Merge branch 'master' in devel-3.0 2009-03-10 16:47:02 +11:00
NeilBrown 388953d27c Release mdadm-2.6.9 2009-03-10 16:38:37 +11:00
NeilBrown 661dce3617 mdmon: allow incremental assembly of containers.
If mdmon sees a device added to a container, it should assume it is
a new spare.  It could be a part of the array that just hadn't been
assembled yet.  So check first.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown bc17324f5e DDF: fix up container_content
If we haven't got hold of all the devices yet, we need to be
ready to skip over some while gathering content information.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown bb50e5d383 Assemble/container: catch errors when starting a partial container.
If we are assembling an array in a container and it isn't complete
enough to start yet, then
  - don't start mdmon
  - don't say the array is started
  - don't wait for the device to appear in /dev


Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown 3092660000 Incremental/container: don't create when we should just be opening.
When incr-assembling in a container, if the array already exists,
don't try to create it again, just open it.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown add394f39e mdopen: be more careful when adding digit to names.
If we need to add digits to a name to make it unique, but don't have
to add '_', we need to avoid adding a digit immediately after a digit.
So if the last character of the name is a digit, add the '_' anyway.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown ecb02e31d5 Incremental: fix some handling of trustworthy.
1/ if homehost matches, then we need to set trustworthy to 'LOCAL'
2/ if we decide to set trustworthy to 'METADATA' because we have to
   use the metadata version name, do that *after* we have checked if
   we are going to assemble within a container, as inside the
   container there could be different sources of names to use.
   

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
NeilBrown bfb7ea78e4 ddf: use better random number generation.
use /dev/urandom rather than calls to 'random()' if possible.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:18 +11:00
NeilBrown bceedeec55 Examine: add examine_export for ddf and avoid crashes.
If the personality doesn't provide export_examine_super, don't crash.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 14:10:52 +11:00
NeilBrown e5a2a3cf8c ddf: fix memory corruption bug.
When adding to a point, you don't need to multiple by the size
of the pointer - C does that for you!
2009-03-09 13:55:59 +11:00
NeilBrown cfccea8c17 DDF: minor formatting improvement
avoid long lines in --examine output
2009-03-09 13:55:13 +11:00
NeilBrown b640a252ee Support new raid6 layouts needed for DDF
DDF raid6 layouts are subtly different from the standard 'md' layouts.
From 2.6.30 the kernel knows about these.
Teach mdadm about them, and also allow 'ddf' to set an appropriate default.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 11:16:53 +11:00
NeilBrown e8e1c176d8 super1/examine: remove confusing information.
The information about how slots and roles in the array lined up
turned out to be confusing.

So simplify it and one provide the interesting information.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 10:38:33 +11:00
NeilBrown 5ea022a16e super1 - do metadata IO in sector_size units.
If the sector size is > 512, we need to be more careful about
alignment.
The largest known sector size is 4096 and (fortunately) both the
superblock and (in many cases) the bitmap are 4096-byte aligned.
So there should be no data-overlap problems.

The exception is when the bitmap is squeezed into the 3K after the
superblock.  This arrangement cannot currently be supported on
4K sector-size devices.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 10:17:42 +11:00
NeilBrown b550887f72 super0: Do all metadata IO with 4096byte alignment
.. because some devices (dasd) have 4096 byte sector size.

As the superblock is 4096 bytes and the bitmap is in a
60K region, this is safe from any possible corruption.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 10:16:17 +11:00
NeilBrown fabf4941b1 Fix udev-rules for case where array isn't really there..
See http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=b822542608326092e177fd1707ca7fb53b2846c4

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 10:14:48 +11:00
NeilBrown 9df04a4f3d super1: make sure max_dev grows enough when adding a device to an array.
There was a few kernel releases where the kernel would shrink max_dev
to be just enough to hold the current number of devices.
More recent kernels never shrink it.
However to be as compatible as possible, if we notice that
max_dev is too small to successfully add a device, increase it.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-09 09:59:39 +11:00
Dan Williams 8be094f0ee imsm: display supported chunk sizes in --detail-platform
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-27 15:35:20 -07:00
Dan Williams fdb482f99b Incremental: honor --no-degraded to delay assembly
Currently Incremental_container is being called after adding each disk.
In the imsm case where spares are not tracked in the raid_disks field we
can use --no-degraded to block premature assembly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams e12e1d1d6a Incremental: fix 'name_to_use' in the container case
Just like the Assemble case, default to the text_version of the
container if another name is not specified.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 1b34f51997 mdmon: update cmdline when scanning
Allows ps -ax | grep mdmon to show:
	mdmon md127
	mdmon md126
...rather than:
	mdmon /proc/mdstat
	mdmon /proc/mdstat

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 7675959b0f mdmon: man page
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 140d3685fb mdmon: fix missed 'clean' event
mdmon may miss events because it re-reads state after read_and_act.  The
additional read is used to determine dirty status before allowing a
sigterm to proceed.  Since read_and_act is in the best position to
determine 'dirty' status and its return value is not used, modify it to
return true if the array is dirty.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams efb30e7f1e imsm: auto layout
In support of auto-layout:

1/ collect and merge all extents to find the largest common-start free region
2/ verify that we meet the "all volumes must use the same set of disks"
2/ mark the disks to be added in add_to_super_imsm_volume

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 18fde300fe Create: fixup 'insert_point', dependent on 'subdevs', for auto-layout
'subdevs' is read from the container in the auto-layout case so reset
subdevs dependent default values.  'insert_point' without this
change is always 2 blocking creation of arrays with > 2 raid disks.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams a9b8734a23 Create: wait_for container creation
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 85f9b5f798 Manage: permit '--remove detached' for containers
Skip the unique holder check in the detached case... pretty sure no one is
holding on to it if open() returns ENXIO.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 04a8ac089c mdmon: record added disks
Prevent duplicate disks from being sent to the monitor thread.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams 7da80e6faa mdmon: fix removed disk handling
Use SKIP_GONE_DEVS when reading the container, and correct some confused
logic in manage_new().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:57 -07:00
Dan Williams dab4a5134e sysfs: allow sysfs_read to detect and drop removed disks
All operations that rely on loading from an existing container (like
--add) will fail after a disk has been removed.  Provide an option to
skip missing / offline disks rather than abort.  We attempt to do this
in the load_super_{imsm,ddf}_all cases when mdmon is running i.e. we
already have a consitent version of the metadata running in the system.
Otherwise, we fail as normal and let the administrator fix up the
container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:56 -07:00
Dan Williams db575f3b9e imsm: retry load_imsm_mpb if we suspect mdmon has made modifications
If the checksum verification fails and mdmon is running we retry the
load to get a consistent snapshot of the mpb.  Found by
tests/08imsm-overlap.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:56 -07:00
Dan Williams ecf45690f2 imsm: verify single sector mpb checksums
If the mpb is only one sector do not skip the checksum verification.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-02-24 18:45:56 -07:00