]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
12 years agoFix off-by-one in readlink() buffer size handling
Thomas Jarosch [Thu, 13 Oct 2011 09:21:07 +0000 (11:21 +0200)] 
Fix off-by-one in readlink() buffer size handling

readlink() returns the number of bytes in the buffer.

If we do something like

len = readlink(path, buf, sizeof(buf));
buf[len] = '\0';

we might write one byte past the end of the buffer.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix: stopped resync does not continue after auto-assemblation
Lukasz Dorau [Sun, 9 Oct 2011 22:16:40 +0000 (09:16 +1100)] 
imsm: fix: stopped resync does not continue after auto-assemblation

Resync stopped with "mdadm -Ss" command does not continue
after issuing "mdadm -As" command.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAlways run Grow_continue() for started array.
Adam Kwolek [Thu, 6 Oct 2011 09:13:22 +0000 (11:13 +0200)] 
Always run Grow_continue() for started array.

So far there were 2 reshape continuation cases:
 1. array is started /e.g. reshape was already invoked during initrd
                      start-up stage using "--freeze-reshape" option/
 2. array is not started yet /"normal" assembling array under reshape case/

This patch narrows continuation cases in to single one. To do this
array should be started /set readonly in to array_state/ before calling
Grow_continue() function.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: always use set_migr_type to set type of migration
Przemyslaw Czarnowski [Wed, 5 Oct 2011 09:59:50 +0000 (11:59 +0200)] 
imsm: always use set_migr_type to set type of migration

For 'resync' besides the update of migration type (imsm_vol.migr_type
structure) additionally status (imsm_dev.status) flag is set to
DEV_VERIFY_AND_FIX. In order to clean up after migration, status flag
must be cleared. For this reason, migration type shouldn't be set
directly but via set_migr_type(). Otherwise status does not reflect
the state of array.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix handling for "auto" line in mdadm.conf
NeilBrown [Thu, 6 Oct 2011 02:00:28 +0000 (13:00 +1100)] 
Fix handling for "auto" line in mdadm.conf

Two problems.

1/ pol_merge was ignoring the pol_auto tag so any 'auto' information
   was lost
2/ If a device had not path (e.g. loop devices) or if there were no
   path-based policies, we didn't bother looking for policy at all.
   So path-independant policies were ignored.

Reported-by: Christian Boltz <suse-beta@cboltz.de>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix: correct adding and activation of spare disks
Lukasz Dorau [Wed, 5 Oct 2011 03:17:38 +0000 (14:17 +1100)] 
imsm: fix: correct adding and activation of spare disks

During activation of spare disks, only one of all available
spare disks can be activated at this moment.
It causes that for example during take-over from
RAID0 with 2 disks to RAID10, only one of two spare disks
is taken for recovery and a degraded RAID10 array
with only 3 of 4 working disks is created.
It has been fixed by adding more than one of all available
spare disks and saving them in additional_test_list
which is passed to imsm_add_spare().

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoSet correct reshape restart position
Adam Kwolek [Wed, 5 Oct 2011 03:00:00 +0000 (14:00 +1100)] 
Set correct reshape restart position

This patch version is simplified compared to previous one.
There is no use of freeze_reshape flag in start_reshape(). It is assumed
that for reshape starting condition reshape_progress field contains
0 value /correct start position/. For reshape restart case, it contains
correct restart position. This approach doesn't make start_reshape()
difficult to read/manage and /imho/ kernel changes to change mdstat
reporting behavior are not necessary.

Setting correct position allows user to see it in the mdstat during
reshape restart and reshape process is not reported as resync.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMonitor reshaped array
Adam Kwolek [Wed, 5 Oct 2011 02:59:28 +0000 (13:59 +1100)] 
Monitor reshaped array

Reshape can be run for monitored arrays only /external metadata case/.
Before reshape can be executed, make sure that just starter array/container
is monitored. If not, run mdmon for it.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoRemove freeze() call from Grow_continue()
Adam Kwolek [Wed, 5 Oct 2011 02:33:29 +0000 (13:33 +1100)] 
Remove freeze() call from Grow_continue()

Grow_continue() for external metadata should be executed on blocked
from monitoring array(s)/container.
Additional call to freeze() is not necessary in such case.
It produces meaningless error message only.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: Fill recovery_blocked field present in mdinfo
Adam Kwolek [Wed, 5 Oct 2011 02:32:28 +0000 (13:32 +1100)] 
imsm: Fill recovery_blocked field present in mdinfo

If any reshape in container is active set recovery_blocked field.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAdd recovery blocked field to mdinfo
Adam Kwolek [Wed, 5 Oct 2011 02:30:50 +0000 (13:30 +1100)] 
Add recovery blocked field to mdinfo

When container is assembled while reshape is active on one of its member
whole container can be required to be blocked from monitoring.
For such purpose field recovery blocked is added to mdinfo structure.

When metadata handler finds active reshape in container it should set
recovery_blocked field to disable whole container monitoring during
reshape.

For arrays that doesn't use containers, recovery_blocked field
has the same value as reshape_active field e.g. super0/1.
In fact,recovery is blocked during reshape for such arrays.
For ddf, metadata handler doesn't set reshape_active field,
so recovery_blocked is not set also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agorestore_backup() throws core dump
NeilBrown [Wed, 5 Oct 2011 02:29:16 +0000 (13:29 +1100)] 
restore_backup() throws core dump

restore_backup() throws core dump during releasing fdlist.
Loop for closing handlers checks next_spare variable,
but iterates disk_count.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMove code to check_mdmon_version() function
Adam Kwolek [Sun, 2 Oct 2011 23:32:02 +0000 (10:32 +1100)] 
Move code to check_mdmon_version() function

Move code to function for code reuse.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: Do not mark resync during reshape
Adam Kwolek [Sun, 2 Oct 2011 23:31:22 +0000 (10:31 +1100)] 
imsm: Do not mark resync during reshape

During reshape, resync/rebuild in the same container is not possible
due to fact that all arrays in container has to share the same disks set.

Block new resync/rebuild process initialization and setting resync_start
to 0 while any reshape in container is active. This avoids breaking
container reshape and doesn't allow for starting multiple processes
/resync/rebuild and reshape/ at the same time in md.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: FIX: Do not allow for spare disk activation during reshape
Adam Kwolek [Sun, 2 Oct 2011 23:30:28 +0000 (10:30 +1100)] 
imsm: FIX: Do not allow for spare disk activation during reshape

Spare disk activation or starting repair for one array while on second
reshape is in progress, will lead to IMSM incompatible situation when
2 arrays in container shares different disks sets.
This can cause that 2 processes in container /reshape and rebuild/
are in progress in parallel. This is IMSM incompatible situation also.

Block spare disk activation and starting resync if any reshape in container
is in progress.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoManual update for --continue option
Adam Kwolek [Sun, 2 Oct 2011 23:09:21 +0000 (10:09 +1100)] 
Manual update for --continue option

Patch adds to mdadm man the following information:

 --continue
   This option is complementary pair to assembly --freeze-reshape option.
   It is needed when --grow operation is interrupted and it is not restarted
   automatically due to --freeze-reshape usage during array assembly.
   Option --continue has to be used together with -G , ( --grow ) command
   and device that it should be executed on.  All parameters required for
   reshape continuation will be read from array metadata.  If initial
   --grow command had required --backup-file= option to be set,
   continuation option will require to  have  exactly the same backup
   file pointed to also.

   Any other parameter passed together with --continue option will be ignored.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoManual update for --continue option
Adam Kwolek [Sun, 2 Oct 2011 23:07:30 +0000 (10:07 +1100)] 
Manual update for --continue option

Patch adds to mdadm man the following information:

--freeze-reshape
  Option  is  intended  to  be used in start-up scripts during initrd boot
  phase.  When array under reshape is assembled during initrd phase,
  this option stops reshape after reshape critical section is being
  restored. This happens before file system pivot operation and avoids lost
  of file system context.  Loosing file system context would cause
  reshape to be broken.

  Reshape can be continued later using -continue option for grow command.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoVerify reshape restart position
Adam Kwolek [Sun, 2 Oct 2011 23:04:32 +0000 (10:04 +1100)] 
Verify reshape restart position

Check if reshape restart position is the same as set in md.
If position doesn't match this means that we cannot restart reshape.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMove code to get_data_disks() function
Adam Kwolek [Sun, 2 Oct 2011 22:57:12 +0000 (09:57 +1100)] 
Move code to get_data_disks() function

Move code to function for code reuse.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAdd continue option to grow command
Adam Kwolek [Sun, 2 Oct 2011 22:26:48 +0000 (09:26 +1100)] 
Add continue option to grow command

To allow for reshape continuation '--continue' option is added
to grow command.
Function that will be executed in grow-continue case doesn't require
information about reshape geometry. All required information are read
from metadata.
For external metadata reshape can be run for monitored array/container
only. In case when array/container is not monitored run mdmon for it.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoDo not continue reshape during initrd phase
Adam Kwolek [Sun, 2 Oct 2011 22:15:22 +0000 (09:15 +1100)] 
Do not continue reshape during initrd phase

During initrd phase continuing reshape will cause file system context
lost. This blocks ability to control reshape using checkpoints.

To avoid this, during initrd phase assemble has to be executed with
'--freeze-reshape' option. This causes that mdadm restores reshape
critical section only.

Reshape can be continued later after system full boot.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agofix: correct unlocking of map file
Lukasz Dorau [Sun, 2 Oct 2011 21:55:02 +0000 (08:55 +1100)] 
fix: correct unlocking of map file

1. Three missing map_unlock() calls were added.
2. Map file must be unlocked on fork, else child will hold lock.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix small memory leak
Thomas Jarosch [Sun, 2 Oct 2011 19:45:41 +0000 (21:45 +0200)] 
Fix small memory leak

Credit goes to cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: Calculate reservation for a spare based on active disks in container
Czarnowska, Anna [Mon, 19 Sep 2011 12:57:48 +0000 (12:57 +0000)] 
imsm: Calculate reservation for a spare based on active disks in container

New function to calculate minimum reservation to expect from a spare
is introduced.

The required amount of space at the end of the disk depends on what we
plan to do with the spare and what array we want to use it in.
For creating new subarray in an empty container the full reservation of
MPB_SECTOR_COUNT + IMSM_RESERVED_SECTORS is required.

For recovery or OLCE on a volume using new metadata format at least
MPB_SECTOR_CNT + NUM_BLOCKS_DIRTY_STRIPE_REGION is required.
The additional space for migration optimization included in
IMSM_RESERVED_SECTORS is not necessary and is not reserved by some oroms.

MPB_SECTOR_CNT alone is not sufficient as it does not include the
reservation at the end of subarray.

However if the real reservation on active disks is smaller than this
(when the array uses old metadata format) we should use the real value.
This will allow OLCE and recovery to start on the spare even if the volume
doesn't have the reservation we normally use for new volumes.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoCreate: improve messages from validate_geometry.
NeilBrown [Wed, 21 Sep 2011 04:39:01 +0000 (14:39 +1000)] 
Create: improve messages from validate_geometry.

When validate_geometry finds that we haven't committed to
a metadata yet and that the subdev is a member of 'our'
container, it needs to report any errors it finds as Create()
cannot report them effectively.

So make a slight change to the semantics of the 'verbose' flag
and allow validate_geometry to report if it printed any error
messages.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoCreate: Allow to create two volumes of different sizes within one container
Lukasz Orlowski [Mon, 19 Sep 2011 16:52:31 +0000 (18:52 +0200)] 
Create: Allow to create two volumes of different sizes within one container

Allows to create RAID 5 volume on 3 disks and then RAID 1 volume on 2
disks withing the same container.

Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMove restore backup code to function
Adam Kwolek [Wed, 21 Sep 2011 02:17:30 +0000 (12:17 +1000)] 
Move restore backup code to function

Reshape backup should be able to be restored during reshape continuation
also. To reuse already existing code it is moved to function.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFIX: Memory leak during Assembly
Adam Kwolek [Wed, 21 Sep 2011 01:55:15 +0000 (11:55 +1000)] 
FIX: Memory leak during Assembly

For fdlist pointer allocated in assemble_container_content() function,
free() is never called. This patch fixes this memory leak.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFIX: Do not unblock array accidentally
Adam Kwolek [Wed, 21 Sep 2011 01:55:08 +0000 (11:55 +1000)] 
FIX: Do not unblock array accidentally

When sysfs_set_array() function is called, it tests if array
can be configured using sysfs. Setting metadata_version entry
can accidentally unblock mdmon when array is under reshape.
To avoid this, blocking character '-' is checked and if is is set,
it is used for array test.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm.8: fix description of "--metadata=1".
NeilBrown [Tue, 20 Sep 2011 23:23:58 +0000 (09:23 +1000)] 
mdadm.8: fix description of "--metadata=1".

This set the metadata to 1.2, not 1.0.
When the default was changed to 1.2 I forgot to update this part of
the man page.

Bug-Debian: http://bugs.debian.org/607375
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix serious memory leak
Lukasz Dorau [Mon, 19 Sep 2011 03:26:05 +0000 (13:26 +1000)] 
Fix serious memory leak

During reshape function restore_stripes is called periodically
and every time the buffer stripe_buf (of size raid_disks*chunk_size)
is allocated but is not freed. It happens also upon successful completion.
In case of huge arrays it can lead to the seizure of the entire
system memory (even of the order of gigabytes).

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: FIX: Spare disk has wrong serial after takeover
Adam Kwolek [Thu, 15 Sep 2011 16:38:39 +0000 (18:38 +0200)] 
imsm: FIX: Spare disk has wrong serial after takeover

Takeover marks disk as failed and adds to serial ':0' string and then
turns it in to spare. This causes that when new spare is about to be used,
it cannot be found due to different disk serial number.

Restore disk serial number to avoid this problem.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoudev rules: use $tempnode, check for supported types, comments
Michal Soltys [Thu, 8 Sep 2011 07:25:08 +0000 (09:25 +0200)] 
udev rules: use $tempnode, check for supported types, comments

Few things adjusted in addition to
0f82fe603a42f37f1e2a6f826b4164811bf2d188:

- keep strict tests for supported types
- when accessing the device, use $tempnode
- few more comments

Signed-off-by: Michal Soltys <soltys@ziu.info>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix readding of a readwrite drive into a writemostly array
Doug Ledford [Mon, 19 Sep 2011 03:06:38 +0000 (13:06 +1000)] 
Fix readding of a readwrite drive into a writemostly array

If you create a two drive raid1 array with one device writemostly, then
fail the readwrite drive, when you add a new device, it will get the
writemostly bit copied out of the remaining device's superblock into
it's own.  You can then remove the new drive and readd it as readwrite,
which will work for the readd, but it leaves the stale WriteMostly1 bit
in devflags resulting in the device going back to writemostly on the
next assembly.

The fix is to make sure that A) when we readd a device and we might have
filled the st->sb info from a running device instead of the device being
readded, then clear/set the WriteMostly1 bit in the super1 struct in
addition to setting the disk state (ditto for super0, but slightly
different mechanism) and B) when adding a clean device to an array (when
we most certainly did copy the superblock info from an existing device),
then clear any writemostly bits.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoMonitor: --oneshot must imply --no-sharing
NeilBrown [Mon, 19 Sep 2011 01:01:19 +0000 (11:01 +1000)] 
Monitor: --oneshot must imply --no-sharing

Moving spares is not the purpose of '--oneshot' and without
currently --oneshot doesn't work as the check against multiple
spare-sharers prevents it.

So make --oneshot imply --no-sharing.  This is sensible and allows
--oneshot to work again.

Reported-by: Jamie Heilman <jamie@audible.transient.net>
Resolves-Debian-Bug: 641886
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoGrow: refuse to grow a 0.90 array beyond 2TB
NeilBrown [Thu, 8 Sep 2011 03:08:51 +0000 (13:08 +1000)] 
Grow: refuse to grow a 0.90 array beyond 2TB

A kernel bug makes handling for arrays using more than 2TB per device
incorrect, and the kernel doesn't stop an array from growing beyond
any limit.
This is fixed in 3.1

So prior to 3.1, make sure not to ask for an array to grow bigger than
2TB per device.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoDiscourage large devices from being added to 0.90 arrays.
NeilBrown [Thu, 8 Sep 2011 03:05:31 +0000 (13:05 +1000)] 
Discourage large devices from being added to 0.90 arrays.

0.90 arrays can only use up to 4TB per device.  So when a larger
device is added, complain a bit.  Still allow it if --force is given
as there could be a valid use.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix component size checks in validate_super0.
NeilBrown [Thu, 8 Sep 2011 02:20:36 +0000 (12:20 +1000)] 
Fix component size checks in validate_super0.

A 0.90 array can use at most 4TB of each device - 2TB between
2.6.39 and 3.1 due to a kernel bug.

The test for this in validate_super0 is very wrong.  'size' is sectors
and the number it is compared against is just confusing.

So fix it all up and correct the spelling of terabytes and remove
a second redundant test on 'size'.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix small memory leak
Thomas Jarosch [Fri, 26 Aug 2011 05:33:37 +0000 (07:33 +0200)] 
Fix small memory leak

Found by cppcheck

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agofix: segfault when killing subarray of non-existent container
Czarnowska, Anna [Mon, 1 Aug 2011 14:33:06 +0000 (15:33 +0100)] 
fix: segfault when killing subarray of non-existent container

Negative value must be returned to indicate error in open_subarray

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoshorten remove rules
Michal Soltys [Wed, 7 Sep 2011 04:02:29 +0000 (14:02 +1000)] 
shorten remove rules

This implicitly adds ddf containers to 'add' and 'remove' rules.

Signed-off-by: Michal Soltys <soltys@ziu.info>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agostart_mdmon: provide more dynamic way to close-all-fds
NeilBrown [Wed, 7 Sep 2011 03:00:32 +0000 (13:00 +1000)] 
start_mdmon: provide more dynamic way to close-all-fds

When forking mdmon we need to close all other fds because we don't
use O_CLOEXEC yet.
Any approach will be fairly arbitrary, but as we can expect fds to be
fairly dense, closing until we find a set number that don't need
closing is possible safer than only closing the first 100.
So keep closing until we find 20 that are already closed.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFIX: Prevent using null list pointer
NeilBrown [Wed, 7 Sep 2011 02:45:24 +0000 (12:45 +1000)] 
FIX: Prevent using null list pointer

When not all attributes are supported (attributes incompatibility)
function container_content_imsm returns NULL pointer.
We need to cope with a NULL list better.

Reported-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFIX: Mdmon crashes after changing RAID level from 1 to 0
Lukasz Dorau [Thu, 1 Sep 2011 13:10:34 +0000 (15:10 +0200)] 
FIX: Mdmon crashes after changing RAID level from 1 to 0

Description of the bug:
Sometimes mdmon crashes after changing RAID level from 1 to 0 (takeover).

Cause of the bug:
The managemon marks an active_array for removal from monitoring
by assigning a->container to NULL value (in the "manage_member" function).
Sometimes (during stress test) it happens right when the monitor
is in the "read_and_act" function and a->container pointer is in use.
This causes the monitor crashes.

Solution:
The active array has to be marked for removal in another way
than setting NULL pointer when it can be in use.
A new field "to_remove" was added to the "active_array" structure.
It is used in the managemon to mark a container to remove
(instead of the old assigment: a->container = NULL)
and monitor checks it to determine if the array should be removed.
The field "to_remove" should be checked in some other places
to avoid managing of the array which is going to be removed.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: support 'missing' devices at Create
Dan Williams [Tue, 30 Aug 2011 03:11:42 +0000 (13:11 +1000)] 
imsm: support 'missing' devices at Create

Specifying missing devices at create is very useful for array recovery.

For imsm create dummy disk entries at init_super_imsm time, and then use
them to fill in unoccupied slots in the final array (if the container is
unpopulated).

If the container is already populated (has a subarray)
'missing' disks must be in reference to already recorded missing devices
in the metadata.

Also add support for --assume-clean for imsm arrays.

Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdmon: fix, close spare activation race
Dan Williams [Fri, 26 Aug 2011 02:14:29 +0000 (19:14 -0700)] 
mdmon: fix, close spare activation race

The following test fails when the md_check_recovery() event triggered by
the ro->rw transition causes remove_and_add_spares() to run while mdmon
is attempting spare activation.

Result is that the kernel races to set the slot immediately after
sysfs_add_disk() writes new_dev.  mdmon thinks the spare activation
failed and declines to send the monitor a new acitve_array.  We show
degraded after the wait because the monitor cannot notify the metadata
that all disks are in_sync.

#!/bin/bash
i=0
false
while [ $? == 1 ]
do
i=$((i+1))
mdadm -Ss
mdadm -CR /dev/md0 /dev/loop[0-2] -n 3 -e imsm
mdadm -CR /dev/md1 /dev/loop[01] missing -n 3 -l 5
mdadm --wait /dev/md1
mdadm -E /dev/loop2 | grep -i degraded
done
echo "failed: $i"

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix reserved sectors for spares
Dan Williams [Fri, 26 Aug 2011 02:14:24 +0000 (19:14 -0700)] 
imsm: fix reserved sectors for spares

Different OROMs reserve different amounts of space for the migration area.
When activating a spare minimize the reserved space otherwise a valid spare
can be prevented from joining an array with a migration area smaller than
IMSM_RESERVED_SECTORS.

This may result in an array that cannot be reshaped, but that is less
surprising than not being able to rebuild a degraded array.
imsm_reserved_sectors() already reports the minimal value which adds to
the confusion when trying rebuild an array because mdadm -E indicates
that the device has enough space.

Cc: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosysfs: fix sysfs_disk_to_scsi_id
Dan Williams [Fri, 26 Aug 2011 02:14:19 +0000 (19:14 -0700)] 
sysfs: fix sysfs_disk_to_scsi_id

Not sure how this ever worked, but now we just try to parse a directory
name that looks like <host>:<bus>:<target>:<lun>.

Array creation segfaults on Fedora 14 without this.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix display spares
Dan Williams [Fri, 26 Aug 2011 02:14:14 +0000 (19:14 -0700)] 
imsm: fix display spares

Commit 94827db3 "imsm: add spares to --examine output." may try to
display failed disks whose imsm_disk info is not uptodate (due to not
being able to look itself up by serial).  The same effect can be had by
just loosening the restriction in print_imsm_disk().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix, stop metadata updates to newly failed devices
Dan Williams [Fri, 26 Aug 2011 02:14:09 +0000 (19:14 -0700)] 
imsm: fix, stop metadata updates to newly failed devices

We already refrain from updating metadata on disks that are failed at
load, need to do the same for new failures.  This also reverts b4add146
as we *do* want to update other disks' view of the failed device as out of
date.

Cc: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix max disks per array
Dan Williams [Fri, 26 Aug 2011 02:14:04 +0000 (19:14 -0700)] 
imsm: fix max disks per array

Validate geometry is incorrectly looking at max disks support which is
irrelevant for md/mdadm.  ->dpa (disks per array) is how many disks the
orom will allow per volume.

Also cleanup an unnecessary ->orom check, is_raid_level_supported()
already does the right thing in the !orom case.

Cc: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomd.4: two typos fixed
Bill Allaire [Mon, 22 Aug 2011 21:24:17 +0000 (17:24 -0400)] 
md.4: two typos fixed

Signed-off-by: Bill Allaire <vger@bogoflop.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomd.4: Fixed typo.
Bill Allaire [Sat, 20 Aug 2011 23:11:03 +0000 (19:11 -0400)] 
md.4: Fixed typo.

Signed-off-by: Bill Allaire <vger@bogoflop.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoudev rules improvement
NeilBrown [Thu, 18 Aug 2011 05:17:52 +0000 (15:17 +1000)] 
udev rules improvement

Don't try to pass and empty path to "mdadm -If" - it will cause
problems.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoUpdate COPYING file.
NeilBrown [Thu, 18 Aug 2011 02:55:24 +0000 (12:55 +1000)] 
Update COPYING file.

Update to latest from http://www.gnu.org/licenses/gpl-2.0.txt
This corrects the address and some other minor details.
No change in the license.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoRAID-6 check standalone man page
Piergiorgio Sartor [Tue, 9 Aug 2011 00:43:58 +0000 (10:43 +1000)] 
RAID-6 check standalone man page

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoIMSM: allow some array attribute bits to be ignored.
NeilBrown [Mon, 8 Aug 2011 22:49:34 +0000 (08:49 +1000)] 
IMSM: allow some array attribute bits to be ignored.

Some bits are not handled by mdadm, but their presence should not
cause failure.
In particular MPB_ATTRIB_NEVER_USE appears harmless.

Reported-by: Thomas Steinborn <thestonewell@googlemail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuper1: fix spacing for 'Flags' field in --examine.
NeilBrown [Tue, 2 Aug 2011 03:36:08 +0000 (13:36 +1000)] 
super1: fix spacing for 'Flags' field in --examine.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years ago--add incorrectly sets writemostly
Scott Schaefer [Tue, 2 Aug 2011 03:27:32 +0000 (13:27 +1000)] 
--add incorrectly sets writemostly

Origin: vendor, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=628667
Bug-Debian: http://bugs.debian.org/628667

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoAdd some more settings of ignore_hw_compat
NeilBrown [Mon, 1 Aug 2011 02:21:19 +0000 (12:21 +1000)] 
Add some more settings of ignore_hw_compat

There are some more times when we don't care that the hardware doesn't
support the metadata:
 - when removing old metadata
 - when reporting the metadata present before over-writing it.

So set ignore_hw_compat in these cases.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoGrow: ensure clean abort if we cannot read the 'completed' file.
NeilBrown [Wed, 27 Jul 2011 07:26:12 +0000 (17:26 +1000)] 
Grow: ensure clean abort if we cannot read the 'completed' file.

If a read of 'completed' returns an error, select will never fail, so
this loop would never exit.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoIMSM: set ->raid_disk correctly in getinfo_super_imsm_volume
NeilBrown [Wed, 27 Jul 2011 06:11:48 +0000 (16:11 +1000)] 
IMSM: set ->raid_disk correctly in getinfo_super_imsm_volume

The 'raid_disk' can be different to the 'number' and must be
the position of the device in the array, not in the container.

Normally these should not be different, but the test-suite creates a
possibility so it should work.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm.8.in: clarify some issues with --size
NeilBrown [Wed, 27 Jul 2011 04:06:13 +0000 (14:06 +1000)] 
mdadm.8.in: clarify some issues with --size

- explain it's use in guarding against small replacements
- clarify relationship with containers.
- include information about --grow --size not being supported by IMSM metadata.

Reported-by: maciej.naruszewicz <maciej.naruszewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoGrow: fix version number in error message
Namhyung Kim [Tue, 19 Jul 2011 04:34:13 +0000 (13:34 +0900)] 
Grow: fix version number in error message

As the conditional checks, reshape to fewer devices is supported
since Linux kernel 2.6.30 not 2.6.32.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: fix default chunk in the !orom case
Dan Williams [Mon, 18 Jul 2011 20:52:29 +0000 (06:52 +1000)] 
imsm: fix default chunk in the !orom case

Set a valid default in the !orom case, otherwise we segfault, or
otherwise fail.

Cc: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoimsm: getinfo_super_imsm_volume() doesn't fill all disk information
NeilBrown [Thu, 14 Jul 2011 05:42:10 +0000 (15:42 +1000)] 
imsm: getinfo_super_imsm_volume() doesn't fill all disk information

getinfo_super_imsm_volume doesn't correctly set info.disk fields
because it doesn't know which disk to set them from.
It should be the last disk passed to add_to_super.

So add a field 'current_disk' to record this disk in add_to_super, and
use it in getinfo_super.

This allows us to remove a hack in Create.c

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm: fix build failures (ppc64)
Milan Broz [Thu, 14 Jul 2011 03:58:36 +0000 (13:58 +1000)] 
mdadm: fix build failures (ppc64)

This patch fixes these build issues:

super-intel.c: In function 'getinfo_super_imsm_volume':
super-intel.c:2327:4: error: format '%llu' expects argument of type 'long long
unsigned int', but argument 3 has type '__u64' [-Werror=format]

super-intel.c: In function 'imsm_reshape_super':
super-intel.c:8665:7: error: 'devnum' may be used uninitialized in this function [-Werror=uninitialized]

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agosuper-intel: fix buffer overflow in detail-platform.
NeilBrown [Wed, 13 Jul 2011 02:38:50 +0000 (12:38 +1000)] 
super-intel: fix buffer overflow in detail-platform.

The serial number is not necessarily nul terminated, so we need to be
sure to only use the allowed number of chars.

Signed-off-by: NeilBrown <neilb@suse.de>
Reported-by: Arvin Schnell <aschnell@novell.com>
12 years agomd.4: fix possible typos
Namhyung Kim [Fri, 24 Jun 2011 04:26:50 +0000 (13:26 +0900)] 
md.4: fix possible typos

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdmon.8: fix possible typos
Namhyung Kim [Fri, 24 Jun 2011 04:26:49 +0000 (13:26 +0900)] 
mdmon.8: fix possible typos

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoShow DELAYED, PENDING status of resync process in "--detail"
Krzysztof Wojcik [Thu, 23 Jun 2011 02:06:47 +0000 (12:06 +1000)] 
Show DELAYED, PENDING status of resync process in "--detail"

Initially there is no proper translation mdstat's DELAYED/PENDING processes
to "--detail" output.
For example, if we have recover=DELAYED in mdstat, "--detail"
shows "State: recovering" and "Rebuild Status = 0%".
It was incorrect in case of process waiting on checkpoint different
than 0%. In fact rebuild status is differnt than 0% and user is misled.

The patch fix the problem. Current "--detail" command shows
in the exampe: "State: recovering (DELAYED)" and no information
about precentage.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm --detail was incorrect for shrinking reshapes
Andrew Burgess [Thu, 23 Jun 2011 01:48:03 +0000 (11:48 +1000)] 
mdadm --detail was incorrect for shrinking reshapes

Since info->delta_disks is signed it doesn't need to be special-cased.

This allowed my 9->8 reshape to display correctly instead of as 8->7

Signed-off-by: NeilBrown <neilb@suse.de>
12 years ago.gitignore: ignore mdadm.8 file
Namhyung Kim [Thu, 23 Jun 2011 01:40:14 +0000 (11:40 +1000)] 
.gitignore: ignore mdadm.8 file

mdadm.8 is auto-generated from mdadm.8.in, so ignore it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm.8: fix possible typos
Namhyung Kim [Thu, 23 Jun 2011 01:40:10 +0000 (11:40 +1000)] 
mdadm.8: fix possible typos

Fix random typos and add a few of missing words/macros.
Also update RAID website URL as it is not accessible anymore.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm.8: move description of --add under Grow mode
Namhyung Kim [Tue, 21 Jun 2011 16:19:03 +0000 (01:19 +0900)] 
mdadm.8: move description of --add under Grow mode

It is supposed to be under Grow mode. Since Create/Build/Grow modes
use common options and '-a' is already used for '--auto' in Create/
Build modes, describe it to avoid confusion.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agomdadm.8: change linux version 2.6.40 -> 3.0
Namhyung Kim [Tue, 21 Jun 2011 16:19:02 +0000 (01:19 +0900)] 
mdadm.8: change linux version 2.6.40 -> 3.0

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoutil: correctly parse shorter linux version numbers.
NeilBrown [Fri, 17 Jun 2011 12:49:24 +0000 (22:49 +1000)] 
util: correctly parse shorter linux version numbers.

The next version of Linux might be 3.0.  If it is, get_linux_version
will fail.
So make it more robust.

Reported-by: Namhyung Kim <namhyung@gmail.com>
Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoRelease mdadm-3.2.2 mdadm-3.2.2
NeilBrown [Fri, 17 Jun 2011 05:15:37 +0000 (15:15 +1000)] 
Release mdadm-3.2.2
Stability release

12 years agoDon't index past the end of 'best' array in Assemble.
NeilBrown [Fri, 17 Jun 2011 04:48:33 +0000 (14:48 +1000)] 
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>
12 years agoImprovements to GPT reading code.
Luca Berra [Fri, 17 Jun 2011 04:41:01 +0000 (14:41 +1000)] 
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>
12 years agoFix some type-aliasing issues.
Luca Berra [Fri, 17 Jun 2011 04:38:14 +0000 (14:38 +1000)] 
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>
12 years agoFix some compiler warnings.
Luca Berra [Fri, 17 Jun 2011 04:35:06 +0000 (14:35 +1000)] 
Fix some compiler warnings.

Original by Luca, with various changes by Neil

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoVarious fixes so that "make everything" works.
NeilBrown [Thu, 16 Jun 2011 07:13:50 +0000 (17:13 +1000)] 
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>
12 years agoMore fixes for tests.
NeilBrown [Thu, 16 Jun 2011 04:18:18 +0000 (14:18 +1000)] 
More fixes for tests.

Some more fixes to help some tests run properly.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agotest/ddf add a udevadm settle
NeilBrown [Wed, 15 Jun 2011 06:30:12 +0000 (16:30 +1000)] 
test/ddf  add a udevadm settle

We need to settle udev before assuming the devices exist.

Signed-off-by: NeilBrown <neilb@suse.de
12 years agoRemove more duplicated code
NeilBrown [Wed, 15 Jun 2011 06:30:09 +0000 (16:30 +1000)] 
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>
12 years agotests/08imsm-overlap - remove duplicated code
NeilBrown [Wed, 15 Jun 2011 06:06:57 +0000 (16:06 +1000)] 
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>
12 years agoddf: fix up getinfo_super_bvd
NeilBrown [Wed, 15 Jun 2011 05:49:23 +0000 (15:49 +1000)] 
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>
12 years agoRemove compiler warning about signed/unsigned comparison.
Albert Pauw [Wed, 15 Jun 2011 04:39:30 +0000 (14:39 +1000)] 
Remove compiler warning about signed/unsigned comparison.

Signed-off-by: NeilBrown <neilb@suse.de>
12 years agoFix imsm-overlap test.
NeilBrown [Wed, 15 Jun 2011 04:39:28 +0000 (14:39 +1000)] 
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>
12 years agoIncr: fix breakage in count_active.
NeilBrown [Wed, 15 Jun 2011 02:21:26 +0000 (12:21 +1000)] 
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>
12 years agoimsm: Metadata Attributes compatibility support
Adam Kwolek [Tue, 14 Jun 2011 13:59:18 +0000 (15:59 +0200)] 
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>
12 years agoimsm: FIX: Sometimes reshape cannot be finished
Adam Kwolek [Tue, 14 Jun 2011 23:13:49 +0000 (09:13 +1000)] 
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>
12 years agoimsm: FIX: klocwork: passed dev pointer to is_gen_migration() can be NULL
Adam Kwolek [Tue, 14 Jun 2011 02:48:58 +0000 (12:48 +1000)] 
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>
12 years agoimsm: Fix: klocwork: targets variable can be used uninitialized
Adam Kwolek [Tue, 14 Jun 2011 02:48:53 +0000 (12:48 +1000)] 
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>
12 years agoimsm: FIX: Migration Raid0->Raid5 cannot be restarted correctly
Adam Kwolek [Tue, 14 Jun 2011 02:46:53 +0000 (12:46 +1000)] 
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>
12 years agoimsm: FIX: Raid5 data corruption data recovering from backup
Adam Kwolek [Tue, 14 Jun 2011 02:42:22 +0000 (12:42 +1000)] 
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>
12 years agoimsm: FIX: Disable automatic metadata rollback for broken reshape
Adam Kwolek [Tue, 14 Jun 2011 02:42:16 +0000 (12:42 +1000)] 
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>
12 years agoimsm: FIX: Use function to obtain array layout
Adam Kwolek [Tue, 14 Jun 2011 02:42:08 +0000 (12:42 +1000)] 
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>
12 years agoFIX: Cannot create volume
Adam Kwolek [Tue, 14 Jun 2011 02:42:06 +0000 (12:42 +1000)] 
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>