Commit Graph

1982 Commits

Author SHA1 Message Date
NeilBrown ef799cdd69 Release mdadm-3.2.2
Stability release
2011-06-17 15:15:37 +10:00
NeilBrown b787bec6bd Don't index past the end of 'best' array in Assemble.
The 'best' array only has 'bestcnt' entries allocated, so 'i' should
always be "< bestcnt", not "<= bestcnt".

Reported-by: "Lawrence, Joe" <Joe.Lawrence@stratus.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-17 14:48:33 +10:00
Luca Berra 73e658d8cc Improvements to GPT reading code.
looking at the gpt code in util.c i found i did not like it at all, a
gpt partition entry is currently 128 bytes, but the spec does not say it
is a fixed value, so the code that reads into a buffer with 512bytes
chunk expecting this to be a multiplier of part_size is imho incorrect.
my fix was to read each partition entry directly into a struct
GPT_part_entry, the advantage is that the code is very simple to read,
the disadvantage it is 128 reads of 128 bytes each, which is
sub-optimal, but i believe readahead will mitigate this a lot.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-17 14:41:01 +10:00
Luca Berra 3b7e9d0cbe Fix some type-aliasing issues.
Warnings for these are reported with -Wstrict-aliasing=2, and
avoiding the cast is certainly an improvement.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-17 14:38:14 +10:00
Luca Berra e4c72d1dc6 Fix some compiler warnings.
Original by Luca, with various changes by Neil

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-17 14:35:06 +10:00
NeilBrown 9e2d750d4c Various fixes so that "make everything" works.
In particular: protect some stuff from MDASSEMBLE and report and error
from 'write'.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-16 17:13:50 +10:00
NeilBrown 4ccc2562ac More fixes for tests.
Some more fixes to help some tests run properly.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-16 14:18:18 +10:00
NeilBrown af538d59c1 test/ddf add a udevadm settle
We need to settle udev before assuming the devices exist.

Signed-off-by: NeilBrown <neilb@suse.de
2011-06-15 16:30:12 +10:00
NeilBrown 67480d7593 Remove more duplicated code
Code from env-imsm-template is also in 09imsm-create-fail-rebuild,
so remove it from there.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 16:30:09 +10:00
NeilBrown d338d8a8e0 tests/08imsm-overlap - remove duplicated code
This test contains a lot of code that is also in env-imsm-template.
So remove it and simple source the other.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 16:06:57 +10:00
NeilBrown fb204fb2e1 ddf: fix up getinfo_super_bvd
Now that getinfo_super clears the info structure, we need
to make sure the correct values are filled in to info->dev.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 15:49:23 +10:00
Albert Pauw 9ec11d1afd Remove compiler warning about signed/unsigned comparison.
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 14:39:30 +10:00
NeilBrown 17f7da2f42 Fix imsm-overlap test.
Now that we reserve space for migration buffer devices are a little
bit smaller so we need to allow for that in the test suite.

Also add a 'udevadm settle' - it seems to help

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 14:39:28 +10:00
NeilBrown 47c7a4be14 Incr: fix breakage in count_active.
If the second device is much newer than the first, but has a lower
raid_disk number, we clear 'avail' badly and don't set up
'best' properly.

Fix these things.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 12:21:26 +10:00
Adam Kwolek 19482bcc40 imsm: Metadata Attributes compatibility support
IMSM's meta data contains Attributes field that contains information about
supported features.
To assembly an array mdadm has to support all features specified by attributes.

The patch introduces new attributes support and validation of the attribuses
during an array assembly.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 09:58:57 +10:00
Adam Kwolek f8b72ef517 imsm: FIX: Sometimes reshape cannot be finished
When array size is not aligned to copy area, number of migration unit
is increased in init_migr_record_imsm():7665 to reshape whole array.
During calculation of last migration unit, this should be in mind also,
otherwise checkpoint (max-1) is always written and reshape
is never finished in mdadm.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-15 09:13:49 +10:00
Adam Kwolek 7534230b07 imsm: FIX: klocwork: passed dev pointer to is_gen_migration() can be NULL
Pointer dev2 passed in write_super_imsm():4451 can be equal to NULL.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:48:58 +10:00
Adam Kwolek 7e45b5504c imsm: Fix: klocwork: targets variable can be used uninitialized
When target_offsets allocation fails execution goes to abort label,
where elements from targets table are closed.

Initialize targets table after allocation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:48:53 +10:00
Adam Kwolek e1c1d4f442 imsm: FIX: Migration Raid0->Raid5 cannot be restarted correctly
When array raid0 is migrated to raid5, reshape cannot be continued
correctly due to wrong array parameters settings.
Raid disks number is set too big.

There is no need, during raid0->raid5 migration to increase
info->array.raid_disks, it is already set to final value using
designation map information.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:46:53 +10:00
Adam Kwolek d1877f697d imsm: FIX: Raid5 data corruption data recovering from backup
Sporadicaly when Raid5's data are restored from backup area,
corruption occurs.
It doesn't happen if reshape process is beyond critical section.

Root cause of the problem is passing wrong starting point in
restore_stripes(). It was hard coded to 0 so far.
This causes that parity disks position in first stripe was always set
to the last raid disk. This position should depend on data position in array.

Proper start position was set and pointer for restoring data
(copy area address) is adjusted to passed start parameter.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:42:22 +10:00
Adam Kwolek b66e591b14 imsm: FIX: Disable automatic metadata rollback for broken reshape
mdmon cannot rollback metadata changes automatically.
It can break reshape process in the way that in case of reshape break
user will not be able to deal with broken reshape due to lack of information
about reshape geometry.

mdadm (process that invokes reshape) doesn't make any rollback to allow
for user action. mdmon should not do this either unless it knows for sure
it is save. such knowledge is not available for automatic rollback.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:42:16 +10:00
Adam Kwolek 68eb8bc6ca imsm: FIX: Use function to obtain array layout
Function imsm_level_to_layout() should be use to get array layout.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:42:08 +10:00
Adam Kwolek 80e4abc99c FIX: Cannot create volume
getinfo_super() can clear entire 'inf' structure before filling with new
information. Disk number required later is lost.

Restore disk number information after getinfo_super() call.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-14 12:42:06 +10:00
Adam Kwolek 0de8d44dde MAN: Man update for check-pointing
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:56 +10:00
Adam Kwolek 8016a6d42e imsm: Optimize expansion speed when no backup is required
When no reshape backup is required (e.g. OLCE after critical section),
check-pointing can use bigger steps than backup space allows for.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:56 +10:00
Adam Kwolek a47e44fb96 imsm: FIX: Remove timeout from wait_for_reshape_imsm()
Timeout should not be used for select function in wait_for_reshape_imsm().

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek ae9f01f89b imsm: FIX: wait_for_reshape_imsm() cleanup
This function needs to be corrected.
It should check sysfs operations status and it should not interpret
0 reshape position special meaning.

Unused input parameter is removed also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek b2c5943816 imsm: FIX: Do not continue reshape when backup exists
When backup exists in copy area reshape cannot be continued.
In such situation, array is in unstable state.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek ccced3dc40 FIX: Move buffer to next location
When no output file is given save_stripes() should collect amount of stripes
in passed buffer. Currently all stripes are saved in the same area in passed
buffer. This causes that last stripe is returned on buffer begin only.
Increase buffer (buf) pointer when save_stripes() is about switch to next
stripe operation. This allows for proper buffer filling as input parameter
length directs.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek a6b6d984e0 imsm: FIX: Remove unused variables and code
Unused variables and code can be removed from imsm_manage_reshape()

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek befb629b0b imsm: FIX: Move reshape_progress forward
When array under reshape is assembled, reshape position used in sysfs_set_array()
should be set to position after recovered from backup area.
This avoids data corruption due to reshape the same array area again.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 6c3560c0f2 imsm: FIX: Detect failed devices during recover_backup_imsm()
Detect in recover_backup_imsm() if not opened disks number is smaller
than allowed degradation for given raid level. This allows for reshape restart
on degraded array.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek ab724b9862 imsm: FIX: Use metadata information for restore_stripes() and save_stripes()
For raid0 reshape imsm uses degraded raid4 for this operation.
Using real raid level (raid0) for stripe calculation causes no need
for parity calculation and can speed up reshape process.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek aea9317117 imsm: FIX: Remove unused parameter from save_backup_imsm() interface
new_data parameter is not used in save_backup_imsm().
It is removed from function interface.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 92144abfbe imsm: FIX: Do not use pba_of_lba0 for copy position calculation
imsm_manage_reshape() should not shift start copy position.
This offset is passed to manage reshape function /and it is used/
as input parameter in offsets table already.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 1ab242d891 imsm: FIX: Do not verify unused parameters
Parameters that are not used by imsm_manage_reshape() should not cause
failure of this function.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 75b69ea420 imsm: FIX: Calculate backup location based on metadata information
Use metadata information to calculate backup write offset.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 7b1ab482f6 imsm: FIX: Use macros to data access
Metadata fields has to be accessed using proper macros.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek e13ce846aa imsm: FIX: Check layout for level migration
When user doesn't specify raid 5 layout for raid0->rai5 migration,
layout structure member is uninitialized. Earlier it cannot be determined
if it is correct or not.
In metadata handle proper verification is placed.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 3ef4403cf6 imsm: FIX: Max position could not be rounded to MB
When rounded array size information from metadata is used for number
of migration units calculation it can occurs that result of units
can be smaller (-1) than required due to used (rounded) array size).

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 0228d92ca3 imsm: FIX: Detect migration end during migration record saving
Checkpoint should be saved when migration is in progress only.
End of reshape (based on passes status) should be detected and it should
not cause abort of reshape/check-pointing/ operation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:55 +10:00
Adam Kwolek 2e062e8210 imsm: FIX: Verify if migration record is loaded correctly
Migration compatibility can be checked when general migration record
is present.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:54 +10:00
Adam Kwolek 6b7a407dce imsm: FIX: Opened handle is not closed
Opened file handle should be closed before function exit.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:54 +10:00
NeilBrown c071a1cd8d restripe: fix compile error in stand-alone program.
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 13:00:46 +10:00
NeilBrown 9894ec0d64 Fix some fall-out from recent memset-zero for getinfo_super
container_content_imsm was setting info->next before calling
getinfo_super_imsm_container which now zeros everything.
So move that assignment to afterwards.

So both imsm and ddf were assuming info->disk.raid_disk means
something but it doesn't.  So fix those.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-09 12:42:02 +10:00
Adam Kwolek 6820c9ab02 imsm: Unit Tests - remove backup-file during grow command
Update reshape/migration unit tests to not to use backup file.
Imsm native check-pointing has to be used (internally) instead.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 17:15:04 +10:00
Adam Kwolek 480be36336 imsm: Remove user warning before reshape start
imsm's arrays supports imsm native check-pointing now.
User warning is no longer required.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 17:14:33 +10:00
Adam Kwolek 13c37ad3f3 Do not use backup file for external metadata
When external metatdata handler supports manage_reshape()
and recover_backup() functions in super switch backup file is not required
and can be omitted. For backup purposes metadata specific mechanisms
are used.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 17:13:30 +10:00
Adam Kwolek e919fb0af2 FIX: Enable metadata updates for raid0
When raid0 is takeovered to degraded raid4, metadata updates has to be
applied via mdmon (raid4 has to be monitored).
It is not possible due to no update_tail pointer initialization
in supertype structure.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 17:13:26 +10:00
Adam Kwolek 0ec5d470e0 imsm: Apply checkpoint metadata update for general migration
mdmon has to update checkpoint information in metadata during
general migration according to received metadata update.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-06-08 17:13:21 +10:00