Commit Graph

1087 Commits

Author SHA1 Message Date
NeilBrown caa0f6c623 Fix gcc-4.4 compiler warning.
Apparently the dereferencing of a type-punned pointer breaks strict
aliasing rules.   And we wouldn't want to do that.
So just make a different array of the appropriate type and use memcpy.

Resolves-Debian-bug: 505375
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-29 11:44:02 +10:00
NeilBrown 667e66d329 Makefile: use $(CC) more consistently.
Explicitly calling 'gcc' in some rules makes it hard to test with
other compilers.
2009-04-29 11:21:08 +10:00
Paul Clements 25affb56b9 mdadm: allow build to use --size
This patch enables the --size parameter for build operations.

Without this, if you have a raid1, for instance, where the 2 disks are
not the exact same size, and you need to build the array but one of the
disks is not available right at the moment (maybe it's USB and it's
unplugged, or maybe it's a network disk and it's unavailable), then you
have to play some weird games to get the array to size correctly (that
is, to the size of the smaller of the two components or less).

There may be other uses for this too...

--
Paul

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-21 15:36:13 +10:00
NeilBrown 2800528713 Wait for POLLPRI on /proc or /sys files.
From 2.6.30, /proc/mounts and various /sys files will
probably always returns 'readable' to select, so we will need
to wait on POLLPRI to get the 'new data is available' signal.

When using select, this corresponds to an 'exception', so
adjust calls to select accordingly.
In one case we sometimes wait on a socket and sometime on
/proc/mounts, so we need to test which.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 14:59:24 +10:00
NeilBrown c256924e52 Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0
Conflicts:
	Grow.c
	mdadm.h
	sysfs.c
Due to independent fixes for the "mdadm hangs if reshape finishes too quickly"
problem.
2009-04-14 11:11:14 +10:00
NeilBrown fa5090285a udev rules fix for partitions.
sysfs directories for partitions do not have md/* files, but
should not for that reason be ignored.

Thanks to Michal Soltys for original fix.

Signed-off-by: Michal Soltys <soltys@ziu.info>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:58:54 +10:00
NeilBrown cf3a3d7888 mapfile: optionally store map file in /dev
During early boot, /var/run may not exist or be writable.
If that happens, sore the mapfile (which is very important for
incremental assembly) in /dev (which should exist for udev).

Thanks to Doug Ledford <dledford@redhat.com> for identify this
problem and suggesting a solution.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:49:40 +10:00
NeilBrown 78e3d2a376 tests: basic ddf tests
Test script to create a ddf with three different member arrays,
and assemble it in a variety of ways.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:19:06 +10:00
NeilBrown 8ab2924c65 tests: add some simple data integrity tests for raid5/raid6
Make sure the data is preserved even when the array is degraded.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:19:05 +10:00
NeilBrown 6161a7a016 .gitignore update
Add a few more generated files to .gitignore

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:19:04 +10:00
NeilBrown 462906cdee incremental_container: preserve 'in_sync' flag when adding to existing array.
When building container members with -IR, we need to ensure that
devices added to an active array preserve the 'in_sync' status so they
don't needlessly get rebuilt.

So allow sysfs_add_disk to do this (only works in kernels since
2.6.30) and pass the relevant flag down.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:19:02 +10:00
Dan Williams 7e7fffc402 mdmon: fix resync completion detection
Starting with 2.6.30 the md/resync_start attribute will no longer return
a non-sensical number when resync is complete, instead it now returns
'none'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 48924014b0 Grow: fix hang when reshape completes too fast
For short reshapes the kernel may be done before mdadm can check that
progress has passed the critical section.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 506ffd1e0b RebuildMap: handle missing disks
When rebuilding the map file tolerate missing/offline disks, otherwise
we will segfault on the NULL return from sysfs_read.

Reported-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 252d23c018 imsm: add the ddf field
This field is always one in arrays created by the Windows driver / OROM,
not sure why...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 979d38be50 imsm: round down array size at Create
Store the 1MB rounded down size of the array at create time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams da9b4a62af imsm: set array size at Create/Assemble
imsm arrays round down the effective array size to the closest 1
megabyte boundary so teach get_info_super_imsm and sysfs_set_array to
set 'md/array_size' if available (and make sure ddf uses the default
size).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams da18878954 imsm: turn off curr_migr_unit updates
New documentation shows that this field is not equivalent to
md/resync_start.  Disable updates until full support can be developed.

Writing '0' when a migration starts/re-starts remains correct.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 1ce0101c9a imsm: defend against unsupported migrations (temporary)
Until support for higher order migrations (online capacity expansion,
raid level migration, chunk size migration...) are implemented do not
allow arrays in these states to be assembled.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
Dan Williams 1484e72797 imsm: add 'verify', 'verify with fixup', and 'general' migration types
imsm distinguishes parity initialization from parity checking in the
metadata. Older option roms marked the repair operation with the
'verify' type and a 'with fixup' flag in the raid device 'status' field.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:27 -07:00
Dan Williams ff5963088d imsm: fix imsm_map.num_domains
'num_domains' is the number of parity domains.  I.e. 2 in the raid10
case (2-mirrors), while raid0 through raid5 have 1 parity domain (even
though raid0 does not have parity).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:27 -07:00
Dan Williams 1f45a8ad20 imsm: ensure mpb buffer is zeroed
Don't leak unitialized data into the mpb.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:27 -07:00
Dan Williams 9d84c8eac2 imsm: support --examine --export
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-11 21:53:25 -07:00
Dan Williams ae2bfd4e13 imsm: make uuid separator consistent with ddf
'-' to ':'

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-11 21:53:25 -07:00
Dan Williams 316e2bf426 imsm: extract right-most whitespace stripped serial number
According to new documentation the metadata expects that all whitespace
(characters <= 0x20) are stripped from the incoming serial number.  If
the length remains longer than MAX_RAID_SERIAL_LEN then only the
right-most characters are preserved.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-08 11:41:51 -07:00
Doug Ledford a9934ce441 mdadm udev rules change
I'm not attaching a patch for this because it's so simple.  Long story
short, watching both add and change events in udev rules is bad for md
devices.  Specifically, the kernel will generate a change event on
things like array stop, and on things like fdisk close.  In the case
of array stop, it can result in the array being assembled again
immediately.  In the case of fdisk close, the situation is worse.
Let's say you stop all the md devices on some block device in order to
repartition.  You run fdisk, change the partition table, then issue a
write of the table.  The write of the table triggers the change event
*before* the kernel updates the partition table in memory for the
block device, causing udev to rerun the incremental rules on the old
partition table and restart all the arrays you just stopped with the
old partition table layout, at which point the kernel is unable to
reread the partition table.  So, once you've enable incremental
assembly, it becomes apparent that what we really want is to only
start devices on add, not on add|change.

--

Doug Ledford <dledford@redhat.com>
2009-04-08 17:32:55 +10:00
Doug Ledford c9b6907ba0 super-ddf: fix compile warnings on ppc64
Simple patch to silence some compile warnings that only show up on
64bit arches.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-08 17:25:52 +10:00
NeilBrown 7c5483270d Incremental - avoid NULL dereference.
There structure returned by sysfs_read might not have any 'devs',
don't assume it does.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:54:09 +10:00
NeilBrown 7f15ccce53 test: minor fixes
- allow core files to be dumped.
 - modprobe md_mod if needed to write to
        /sys/module/md_mod/parameters/....

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:50:34 +10:00
NeilBrown 03b7f6c6bd Incremental: be more relaxed about member arrays not completely assembling.
During incremental assembly, if the member array doesn't assemble
properly (yet), that isn't an error.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-07 17:49:05 +10:00
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