]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
14 years agoFIX: Unfreeze array on success only
Adam Kwolek [Thu, 10 Mar 2011 07:30:42 +0000 (08:30 +0100)] 
FIX: Unfreeze array on success only

Unfreeze array on success only.
rv is initialized by restart variable so we have 2 cases.
1. regular reshape start
rv == restart == 0
   this means that real error (returned by reshape) can cause leaving container frozen
   If array is not touched by reshape it can be unfrozen
2. During reshape restart even untouched array under reshape is left unfrozen,
   If reshape is started do not unfreeze array on error also.

This allows user for array repair action
(mdmon will not change array state).

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMerge branch 'master' into devel-3.2
NeilBrown [Thu, 10 Mar 2011 06:37:04 +0000 (17:37 +1100)] 
Merge branch 'master' into devel-3.2

Conflicts:
Grow.c
Manage.c
managemon.c
mdadm.8.in
util.c

14 years agoManage: be more careful about --add attempts.
NeilBrown [Mon, 22 Nov 2010 08:35:25 +0000 (19:35 +1100)] 
Manage:  be more careful about --add attempts.

If an --add is requested and a re-add looks promising but fails or
cannot possibly succeed, then don't try the add.  This avoids
inadvertently turning devices into spares when an array is failed but
the devices seem to actually work.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoddf: remove duplicate container_member setting.
NeilBrown [Mon, 22 Nov 2010 08:35:25 +0000 (19:35 +1100)] 
ddf: remove duplicate container_member setting.

We were setting ->container_member twice in ddf get_info.
Once to currentconf->vcnum,
once to atoi(st->subarray).

Both should be the same.
For consistency with super-intel, use the first.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix warning about host-endian bitmaps.
NeilBrown [Tue, 30 Nov 2010 05:25:26 +0000 (16:25 +1100)] 
Fix warning about host-endian bitmaps.

Hostendian bitmaps should be warned about on all arch's.
And fix a speeling mistake.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: give useful message when adding bitmap gives EBUSY.
NeilBrown [Tue, 30 Nov 2010 05:34:25 +0000 (16:34 +1100)] 
Grow: give useful message when adding bitmap gives EBUSY.

If adding a bitmap fails with EBUSY, then it is because the array is
currently resyncing/recovering/reshaping.
As this is non-obvious, give a message explaining the fact.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAssemble: add --update=no-bitmap
NeilBrown [Tue, 30 Nov 2010 05:46:01 +0000 (16:46 +1100)] 
Assemble: add --update=no-bitmap

This allows an array with a corrupt internal bitmap to be assembled
without the bitmap.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAssemble: call remove_partitions later.
NeilBrown [Tue, 30 Nov 2010 05:56:01 +0000 (16:56 +1100)] 
Assemble: call remove_partitions later.

We shouldn't call remove_partitions until we have made a really firm
decision to include the device into the array.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdmon: don't copy an invalid chunk_size
NeilBrown [Tue, 30 Nov 2010 07:35:36 +0000 (18:35 +1100)] 
mdmon: don't copy an invalid chunk_size

As chunk_size in mdstat_ent is never set, we shouldn't copy
it into a->info.array.
In fact, it is safest to get rid of the field altogether.

Reported-by: "Kwolek, Adam" <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoddf: fail creation of new subarray with same name as old.
NeilBrown [Tue, 30 Nov 2010 22:55:35 +0000 (09:55 +1100)] 
ddf: fail creation of new subarray with same name as old.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoCreate: report failure if array cannot be started.
NeilBrown [Wed, 1 Dec 2010 00:03:28 +0000 (11:03 +1100)] 
Create: report failure if array cannot be started.

We weren't checking the result of writing 'active' to array_state

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: disallow placing backup file on array being reshaped.
NeilBrown [Wed, 1 Dec 2010 00:58:32 +0000 (11:58 +1100)] 
Grow: disallow placing backup file on array being reshaped.

the tests here aren't perfect, but they could catch some cases.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoCreate/grow: improve checks on number of devices.
NeilBrown [Wed, 1 Dec 2010 03:51:27 +0000 (14:51 +1100)] 
Create/grow: improve checks on number of devices.

Check on upper limit of number of devices was in the wrong place.
Result was could not create array with more than 27 devices without
explicitly setting metadata, even though default metadata allows more.

Fixed, and also perform check when growing an array.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoerror check reading of 'degraded' from sysfs.
NeilBrown [Thu, 20 Jan 2011 21:59:00 +0000 (08:59 +1100)] 
error check reading of 'degraded' from sysfs.

I'm seen mdadm spinning while failing to read 'degraded'.
This doesn't really fix it, but is a reminder that it needs to be
fixed.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Reset disk state if disk is missing
Krzysztof Wojcik [Thu, 10 Mar 2011 06:07:04 +0000 (17:07 +1100)] 
FIX: Reset disk state if disk is missing

If we can't read actual disk state, it shoud be initiated
to 0.
Overwise it may be out of date value resulting false action
later in code (e.g. set disk to improper state).

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoopen_mddev: open RDONLY if RDWR doesn't work.
NeilBrown [Thu, 10 Mar 2011 06:07:04 +0000 (17:07 +1100)] 
open_mddev: open RDONLY if RDWR doesn't work.

If an array is read-only then "mdadm -S"
cannot open it to stop it without this fix.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoInitialise all of file when opening backup file for reshape.
NeilBrown [Thu, 10 Mar 2011 06:06:59 +0000 (17:06 +1100)] 
Initialise all of file when opening backup file for reshape.

Due to a miscalculation we didn't initialise the whole file.
There is 4K (8 sectors) for the metadata, then the data.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdadm.man add encouragement to shrink filesystem before shrinking array.
NeilBrown [Tue, 15 Feb 2011 01:40:21 +0000 (12:40 +1100)] 
mdadm.man add encouragement to shrink filesystem before shrinking array.

Before resizing an array with --size or --array-size, then filesystem
should be resized.  mdadm cannot do this so the user should.

Reported-by: Gavin Flower <gavinflower@yahoo.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoDetail: report subarrays of a container properly.
NeilBrown [Wed, 9 Mar 2011 07:22:27 +0000 (18:22 +1100)] 
Detail: report subarrays of a container properly.

Due to the wrong variable being used, this part of --detail
wasn't working at all.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agodev_open should always open read-only.
NeilBrown [Thu, 10 Mar 2011 00:41:21 +0000 (11:41 +1100)] 
dev_open should always open read-only.

When opening an array to manipulate it we never need to write to the
array and  sometimes it might be read-only so the open for write will
fail.
So always open read-only.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMan page updates for new --grow options.
NeilBrown [Thu, 10 Mar 2011 05:41:54 +0000 (16:41 +1100)] 
Man page updates for new --grow options.

Describe all the new ways that mdadm can reshape arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: allow monitor thread to exit when there is nothing more to do.
NeilBrown [Thu, 10 Mar 2011 04:59:24 +0000 (15:59 +1100)] 
Grow: allow monitor thread to exit when there is nothing more to do.

When an array using native metadata is increasing in size, we don't
need to keep monitoring it after the initial 'critical section'.
So detect that case.
If a final level-change is still needed mdadm will wait for that,
otherwise it will simply exit.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: don't forget_backup when length of backup is zero.
NeilBrown [Thu, 10 Mar 2011 04:43:04 +0000 (15:43 +1100)] 
Grow: don't forget_backup when length of backup is zero.

This is just a waste of IO

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: make sure 'info' doesn't have confusing data.
NeilBrown [Thu, 10 Mar 2011 04:36:07 +0000 (15:36 +1100)] 
Grow: make sure 'info' doesn't have confusing data.

We now test ->reshape_active, but don't set it in a common case.

So just zero out the whole structure to be on the safe side.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: support reshape of RAID0 arrays.
NeilBrown [Thu, 10 Mar 2011 04:05:23 +0000 (15:05 +1100)] 
Grow: support reshape of RAID0 arrays.

This is done via conversion to RAID4 and back.

To grow the array, extra devices will be needed which cannot
already be present as spares - so allow a list of new devices
to be included in grow request which changed the number of devices.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: Allow for component_size not being set for RAID0 arrays.
NeilBrown [Thu, 10 Mar 2011 04:00:38 +0000 (15:00 +1100)] 
Grow: Allow for component_size not being set for RAID0 arrays.

When an RAID0 is started using SET_ARRAY_INFO ioctl the
component_size will be zero.
This confused the code for reshaping a RAID0 via RAID4.

So if that seems to be the case, fake a believable component_size

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoMake find_intel_hba_capability less verbose.
NeilBrown [Thu, 10 Mar 2011 03:53:30 +0000 (14:53 +1100)] 
Make find_intel_hba_capability less verbose.

mdadm has a convention in some areas of passing a device name
if error messages about it are interesting, or NULL if not.

Follow this convention with find_intel_hba_capability so that it
doesn't complain when not appropriate - and so that it doesn't
have to go and find a device name that it wasn't given.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoplatform_intel: support for OROM OEM capabilities
Labun, Marcin [Thu, 10 Mar 2011 00:52:22 +0000 (11:52 +1100)] 
platform_intel: support for OROM OEM capabilities

Scan memory to match $VER and $OEM.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: introduce SAS controller support in imsm metadata handler
Labun, Marcin [Thu, 10 Mar 2011 00:52:15 +0000 (11:52 +1100)] 
imsm: introduce SAS controller support in imsm metadata handler

OROM/EFI capabilities are retrieved based on disk's controller type.
1/ alloc_super no longer retrieves OROM capabilities
2/ find_imsm_capability replaces find_imsm_orom
3/ new function find_intel_hba_capability gets disk's HBA and relevant
capability

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: move code for retrieving HBA to a function
Labun, Marcin [Thu, 10 Mar 2011 00:50:58 +0000 (11:50 +1100)] 
imsm: move code for retrieving HBA to a function

Function find_intel_hba_capability attaches HBA information
to intel_super structure based on fd of the component disk.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: verify that component disks are attached to the same type of HBA
Labun, Marcin [Thu, 10 Mar 2011 00:50:57 +0000 (11:50 +1100)] 
imsm: verify that component disks are attached to the same type of HBA

compare_super_imsm verifies that the component disks use the same type of HBA
in platform dependent environment. Otherwise print-out error message and block
the action.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: add maximum number of disk validation in RAID array
Labun, Marcin [Thu, 10 Mar 2011 00:50:54 +0000 (11:50 +1100)] 
imsm: add maximum number of disk validation in RAID array

Arrays exceeding the OROM/EFI maximum number of supported disk are
blocked in validate_geometry_imsm_orom function.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: print-out error message when volume validation fails
Labun, Marcin [Thu, 10 Mar 2011 00:50:52 +0000 (11:50 +1100)] 
imsm: print-out error message when volume validation fails

Print-out error message when volume geometry fails to comply with
OROM/EFI controller's capabilities.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: do not publish OROM/EFI unsupported arrays
Labun, Marcin [Thu, 10 Mar 2011 00:50:49 +0000 (11:50 +1100)] 
imsm: do not publish OROM/EFI unsupported arrays

Container_content_imsm calls validate_goemtry_imsm_orom to verify that
the array parameters are supported by controller's OROM/EFI.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: detail_platform_imsm displays AHCI and SAS controller information
Labun, Marcin [Thu, 10 Mar 2011 00:46:11 +0000 (11:46 +1100)] 
imsm: detail_platform_imsm displays AHCI and SAS controller information

The function uses find_intel_device and find_imsm_capability to present
AHCI and SAS controller capabilities taken from OROM or EFI.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: remove unused parameters in function attach_hba_to_super
Labun, Marcin [Thu, 10 Mar 2011 00:45:49 +0000 (11:45 +1100)] 
imsm: remove unused parameters in function attach_hba_to_super

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoread platform capabilities from EFI
Labun, Marcin [Thu, 10 Mar 2011 00:45:35 +0000 (11:45 +1100)] 
read platform capabilities from EFI

If operating system is installed using efi, IMSM platform capabilities are
 not available via option ROM, but are stored as efi variables. New
 mechanism has been introduced to obtain capabilities by variables.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoSome guid manipulation utilities has been added.
Labun, Marcin [Thu, 10 Mar 2011 00:45:15 +0000 (11:45 +1100)] 
Some guid manipulation utilities has been added.

It will be used for reading efi variables with capabilities.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoupdate of imsm_orom structure
Labun, Marcin [Thu, 10 Mar 2011 00:45:00 +0000 (11:45 +1100)] 
update of imsm_orom structure

The structure is update according to current specification. These values
are not used right now, but they are not "reserved" anymore.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoPlatform-intel: support for OROM SAS and AHCI controller
Labun, Marcin [Thu, 10 Mar 2011 00:44:21 +0000 (11:44 +1100)] 
Platform-intel: support for OROM SAS and AHCI controller

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoprobe_roms: allow to probe expansion ROMs using vendor and device id.
Labun, Marcin [Thu, 10 Mar 2011 00:41:46 +0000 (11:41 +1100)] 
probe_roms: allow to probe expansion ROMs using vendor and device id.

Adds data offset to PCI expansion ROM Data Structure in resource
describing Expansion ROMs. This allows AHCI OROM scanning function
to identify AHCI OROM by device id 0x2822 and vendor id 0x8086.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm : FIX: Assemble dirty array when reshape is in progress
Adam Kwolek [Thu, 10 Mar 2011 00:41:33 +0000 (11:41 +1100)] 
imsm : FIX: Assemble dirty array when reshape is in progress

During reshape for dirty volumes reshape_progress has to be calculated
also.  To keep the same logic for array creation:
  not setting info->resync_start = MaxSector when first condition is
  true,
  resync_start is initialized by MaxSector to allow proper array
  initialization.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Set 'active' array state before array configuration
Adam Kwolek [Thu, 10 Mar 2011 00:41:28 +0000 (11:41 +1100)] 
FIX: Set 'active' array state before array configuration

For not reshaped array in container during assembly array is in
auto-read-only state.  It is not possible to set disk slot for such
array and later reshape cannot be started also.  To move array from
'auto-read-only' to 'active' state storing 'active' state to sysfs is
added. This allows for disks configuration and reshape.

During reshaped array restart it is disabled by condition on restart
variable.

When reshape is starting, storing 'active' state to already active
array should not matter.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agodev_open should always open read-only.
NeilBrown [Thu, 10 Mar 2011 00:41:21 +0000 (11:41 +1100)] 
dev_open should always open read-only.

When opening an array to manipulate it we never need to write to the
array and  sometimes it might be read-only so the open for write will
fail.
So always open read-only.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRemove incorrect use of open_dev
NeilBrown [Thu, 10 Mar 2011 00:36:47 +0000 (11:36 +1100)] 
Remove incorrect use of open_dev

open_dev can only be used for md array.  To open an
arbitrary device, dev_open must be used.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: make sure mdmon is running for Grow_continue arrays.
NeilBrown [Thu, 10 Mar 2011 00:36:47 +0000 (11:36 +1100)] 
Grow: make sure mdmon is running for Grow_continue arrays.

when starting an array that is in the middle of a migration,
we need to start mdmon, just as we do for arrays which are not
in the middle of a migration.

Repored-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Make expansion counter usable
Adam Kwolek [Wed, 9 Mar 2011 22:58:35 +0000 (09:58 +1100)] 
FIX: Make expansion counter usable

Currently whole array geometry is set in sysfs_set_array(),
so none of disks (even for expansion) should fail during sysfs_add_disk()
Due to this expansion counter should be used for reshaped array when
disk slot is bigger than number of disks in array.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Block reshaped array monitoring
Adam Kwolek [Wed, 9 Mar 2011 22:57:39 +0000 (09:57 +1100)] 
FIX: Block reshaped array monitoring

When array under reshape is assembled it has to be disabled from
monitoring as soon as possible. It can occur that this is i.e second
array in container and mdmon is loaded already.
Lack of blocking monitoring can cause change array state to active,
and reshape continuation will be not possible.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Load container content for container reshape continuation
Adam Kwolek [Wed, 9 Mar 2011 22:54:56 +0000 (09:54 +1100)] 
FIX: Load container content for container reshape continuation

st->sb is null. This is exception cause.
reshape_container() function expects that super block will be loaded.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: don't let analyse_change see new level from metadata.
NeilBrown [Wed, 9 Mar 2011 07:53:09 +0000 (18:53 +1100)] 
Grow: don't let analyse_change see new level from metadata.

This is a bit of a hack - probably analyse change needs to be
re-written a bit to handle this properly.

However when the metadata deduced the intermediate state for a
reshaping array, the 'new_level' it sets should not be used to
interpret the 'delta_disks' number.
So in that case, hide the new_level while calling analyse_change.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: don't try to use 'raid_disks' value for a container.
NeilBrown [Wed, 9 Mar 2011 07:50:59 +0000 (18:50 +1100)] 
Grow: don't try to use 'raid_disks' value for a container.

The 'raid_disks' for a container is zero, so subtracting it
from the given raid_disks to get delta_disks doesn't make sense.

Rather set delta_disks to UnSet and set raid_disks to the requested
number of disks.   This then gets passed to reshape_super() which
can use it as required.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: only check 'native format' when really needed.
NeilBrown [Wed, 9 Mar 2011 07:47:24 +0000 (18:47 +1100)] 
Grow: only check 'native format' when really needed.

The check that the array info is already in 'native format' is
only relevant when restarting a growth, so only perform it then.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Check correct 'old' level to see if reshape is needed.
Adam Kwolek [Tue, 8 Mar 2011 12:24:55 +0000 (13:24 +0100)] 
FIX: Check correct 'old' level to see if reshape is needed.

Normally when reshape_array is called with restart == 0,
info->array is the same as the 'array' read from the kernel
(via ioctl) so both have the same level.

However when called from reshape_container, info->array was
generated by the metadata so it will have 'level' set to the
intermediate (or final) level already.

So to test if we need to change the level, we need to compare the
desired level with that which was loaded from the kernel (array.level)
rather than that which was read from metadata (info->array.level).

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: add check that there are enough devices.
NeilBrown [Wed, 9 Mar 2011 07:37:00 +0000 (18:37 +1100)] 
Grow: add check that there are enough devices.

The check for 'enough spares' doesn't apply to RAID0 as we don't
mind it going degraded.  But add a test that there are enough spares
to actually produce a working array.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoTypo in dprintf
NeilBrown [Wed, 9 Mar 2011 07:31:56 +0000 (18:31 +1100)] 
Typo in dprintf

Canot -> Cannot

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix comment in progress_reshape
NeilBrown [Wed, 9 Mar 2011 07:31:15 +0000 (18:31 +1100)] 
Fix comment in progress_reshape

The possible return values have changed since that comment.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoGrow: allow a RAID1 to be reshaped directly to 3-drive RAID5
NeilBrown [Wed, 9 Mar 2011 07:30:03 +0000 (18:30 +1100)] 
Grow: allow a RAID1 to be reshaped directly to 3-drive RAID5

Self-tests require this but code didn't allow it any more.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix chunksize defaulting.
NeilBrown [Wed, 9 Mar 2011 07:27:19 +0000 (18:27 +1100)] 
Fix chunksize defaulting.

the new code for defaulting chunksizes didn't work quite right
 - default was set to late in super1/super0/ddf
 - defaults would over-ride values of '0' imposed by some levels
 - default value wasn't applied to size properly.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoDetail: report subarrays of a container properly.
NeilBrown [Wed, 9 Mar 2011 07:22:27 +0000 (18:22 +1100)] 
Detail: report subarrays of a container properly.

Due to the wrong variable being used, this part of --detail
wasn't working at all.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: Mark checkpoint and array state clean during reshape
Adam Kwolek [Tue, 8 Mar 2011 22:03:54 +0000 (09:03 +1100)] 
imsm: FIX: Mark checkpoint and array state clean during reshape

Array state has to be managed during reshape based on consistent flag.
To achieve this existing code will be reused. Currently existing code for
blocks_per_unit calculation can be removed
and existing code can be reused also.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAllow Grow_continue for whole container as well as single array.
NeilBrown [Tue, 8 Mar 2011 06:36:40 +0000 (17:36 +1100)] 
Allow Grow_continue for whole container as well as single array.

Some grow operations must be applied to a whole container.  These
are performed one array at a time, so only one array appears to
be reshaping.

When re-assembling such an array, we need to make sure that
when the reshape finished, we move on to the next array.

So require metadata to set ->reshape_active = 2 in that case,
and use reshape_container to complete the reshape.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: Variables declaration cleanup
Adam Kwolek [Tue, 8 Mar 2011 06:18:44 +0000 (17:18 +1100)] 
imsm: FIX: Variables declaration cleanup

Variables declaration moved a little bit up,
to not mix declaration and code.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoRun Grow_restart/Grow_continue when assembling the content of a container.
NeilBrown [Tue, 8 Mar 2011 06:14:00 +0000 (17:14 +1100)] 
Run Grow_restart/Grow_continue when assembling the content of a container.

As containers can now grow, we need to use both Grow_restart (to
replay any backup-file) and Grow_continue when assembling the content
of a container.

Note that we don't pass a backup-file when doing incremental assembly.
If such is needed in that case, the assembly will fail.

To restart such arrays, explicit assembly is required.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: Return blocks_per unit for general migration
Adam Kwolek [Tue, 8 Mar 2011 05:10:35 +0000 (16:10 +1100)] 
imsm: FIX: Return blocks_per unit for general migration

For general migration, blocks per unit are required for all disks,
not for per-member.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoChange way that reshaping arrays with external-metadata are assembled.
NeilBrown [Tue, 8 Mar 2011 05:10:29 +0000 (16:10 +1100)] 
Change way that reshaping arrays with external-metadata are assembled.

Now that the external metadata handler must provide an md-compatible
old/new geometry, sys_set_array can do all of the array set-up for
an array that is undergoing reshape.
That leave less for reshape_array to do.

Also clean up how reshape_array tells if the reshape has started or
not.
Don't use ->reshape_active as that doesn't tell us anything consistent
at this stage, only use the 'restart' flag passed in.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: improve getinfo_super when reshape is in progress.
NeilBrown [Tue, 8 Mar 2011 04:59:09 +0000 (15:59 +1100)] 
imsm: improve getinfo_super when reshape is in progress.

If a reshape (migration) is happening, we might need to modify the information
with provide to md so that it can cope with the reshape.
For example, if a migration from 4-device RAID0 to 5-device RAID0 is
happening, we need to tell md that it is reshape from degraded
5-device RAID4 to degraded 6-device RAID4 so md doesn't handle direct
reshape of RAID0.

There may be other migrations supported by IMSM that need special
treatment here.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoEnable error message in case of lack of spares for grow
Krzysztof Wojcik [Wed, 2 Mar 2011 16:33:01 +0000 (17:33 +0100)] 
Enable error message in case of lack of spares for grow

When we cannot find spare devices for grow operation we should
print error message.
This patch changes debug error message to 'stderr' print.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agofix: generated udev rules does not work due to incorrect line format
Hawrylewicz Czarnowski, Przemyslaw [Mon, 7 Mar 2011 22:51:31 +0000 (09:51 +1100)] 
fix: generated udev rules does not work due to incorrect line format

Problem consists of missing =sign in comparison with SUBSYSTEM and
missing new line character at the end of line. As a result incremental
for hot-plugs of bare disks does not work.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoddf: exclude failed devices from container_content
NeilBrown [Wed, 2 Mar 2011 22:04:42 +0000 (09:04 +1100)] 
ddf: exclude failed devices from container_content

If a device is failed, then don't include it in the reported
container_content, else it might get included in the array.

Reported-by: Albert Pauw <albert.pauw@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoContinue reshape after assembling array
Adam Kwolek [Wed, 2 Mar 2011 01:28:15 +0000 (12:28 +1100)] 
Continue reshape after assembling array

assemble_container_content() cannot close mdfd handle, as it could be
required by reshape continuation.
mdfd handle is closed outside this function, when it is not longer
necessary.
Call to Grow_continue is added for reshape continuation after
assembly.

In the nearest future, simple condition:
    if (content->reshape_active)
before Grow_continue() call will be replaced by check function
for support container operation /reshape/.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoAdd block_subarray()
Adam Kwolek [Wed, 2 Mar 2011 01:28:13 +0000 (12:28 +1100)] 
Add block_subarray()

Put code for blocking subarray in to separate function.
This little code/function will be used for blocking arrays from mdmon
monitoring during assembly process. Arrays cannot wait for container
assembly finish, because meanwhile monitor can enable arrays for writing.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Set readonly state in Grow_continue() when necessary
Adam Kwolek [Mon, 28 Feb 2011 15:07:19 +0000 (16:07 +0100)] 
FIX: Set readonly state in Grow_continue() when necessary

When assembling array using assemble_container_content() for external
metadata case, array is in 'readonly' state already.
There is not necessary to duplicate this operation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Pass container name to reshape array for external meta data
Adam Kwolek [Mon, 28 Feb 2011 15:07:11 +0000 (16:07 +0100)] 
FIX: Pass container name to reshape array for external meta data

When calling reshape_array() for external metadata 'container name'
parameter have to be passed.
Find and pass container name in external metadata case.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Spelling error in dprintf output
Adam Kwolek [Mon, 28 Feb 2011 15:07:03 +0000 (16:07 +0100)] 
FIX: Spelling error in dprintf output

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdadm.man: remove duplicate documentation for --array-size
NeilBrown [Wed, 2 Mar 2011 00:34:49 +0000 (11:34 +1100)] 
mdadm.man: remove duplicate documentation for --array-size

We somehow got to version of documentation for --array-size.
So merge them it one.

Reported-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: disks added beyond array should be counted during reshape
Adam Kwolek [Wed, 23 Feb 2011 13:51:39 +0000 (14:51 +0100)] 
FIX: disks added beyond array should be counted during reshape

During expansion there is more working disks that array can have.
Disks with set raid_disk (not a spare disk) during reshape should be counted
to allow array state transition to read_only state.

Array reconfiguration to new geometry should be done before reshape will
be started.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoPartitions could be meaningful on single-drive RAID0
Krzysztof Wojcik [Fri, 25 Feb 2011 06:30:51 +0000 (07:30 +0100)] 
Partitions could be meaningful on single-drive RAID0

If we create a single-drive RAID0 array on partitioned drive,
we do not lose information about disk structure after operation
(partitions are visible on created array)
Warning message:

mdadm: partition table exists on /dev/sdX but will be lost or
       meaningless after creating array"

is not necessary during creation single-drive RAID0 array.
This patch removes the message.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: imsm: OROM does not recognize degraded arrays (V2)
Krzysztof Wojcik [Fri, 25 Feb 2011 01:17:18 +0000 (02:17 +0100)] 
FIX: imsm: OROM does not recognize degraded arrays (V2)

Defect description:
When we create an redundant array in mdadm and then degrade it
by disk removing, Option ROM and Windows OS does not detect any array.
Reason:
Metadata created and updated after degrading array is not compatible
with IMSM standard.

This patch synchronizes the metadata according IMSM requirements.
Following inconsistencies have been fixed:
- reset all fields in imsm_dev during creation to avoid random values
- init dev status during creation to proper state
- not reset CONFIGURED_DISK flag when disk is missing
- add ":0" suffix to the serial number for missing/failed disks
- update medatada signature after takeover operation
- mark map state as degraded after raid0->raid10 takeover

Note:
Patch reworked after Dan Willams review.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: ReadMe.c -Y option missing in short_options
Albert Pauw [Sun, 27 Feb 2011 04:56:54 +0000 (15:56 +1100)] 
FIX: ReadMe.c -Y option missing in short_options

Hi Neil,

I noticed that the -Y option, as in mdadm -D -Y /dev/md0, doesn't work
but used as --export it works.

So I made a little patch to fix it, but it is simply sticking a Y in the
list of short_options in ReadMe.c.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: Report correct array size during reshape
Adam Kwolek [Tue, 22 Feb 2011 14:13:31 +0000 (15:13 +0100)] 
imsm: FIX: Report correct array size during reshape

When reshape is started imsm stores new size in metadata.
mdadm requires "old" size to proper initialization restarted array.

When reshape is in progress getinfo_super_imsm_volume() should report
computed array size value instead array size stored in metatda.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: initalize reshape progress as it is stored in metatdata
Adam Kwolek [Tue, 22 Feb 2011 14:13:23 +0000 (15:13 +0100)] 
imsm: FIX: initalize reshape progress as it is stored in metatdata

reshape prodess cannot be restarted due to no checkpoint information
in mdinfo.
When metadata is read during reshape process or reshape restart,
rehape_progress (mdinfo field) has to be initialized to value
stored in metadata. This allows start reshape from stored
in metadata checkpoint.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoset default chunk in validate_geometry
Czarnowska, Anna [Tue, 22 Feb 2011 00:25:07 +0000 (11:25 +1100)] 
set default chunk in validate_geometry

When chunk size is not set from command line we need to guess it
depending on metadata given on command line or found on listed devices.

Validate_geometry sets the default for it's metadata if chunk is not set.
For external metadata chunk is set only when creating in a container.
For imsm validate_geometry_imsm_orom is responsible for finding default
chunk depending on container metadata loaded. Container will already know
which controller it is attached to, and have this controllers orom
available.
do_default_chunk indicates that we need to find default chunk and
if validate_geometry fails for some metadata it tells us to reset chunk
that may have been set.

Current solution would set default chunk correctly for imsm only if
container device was given on command line. With the list of devices
chunk was always set to 512.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agofix: memory leak in Create
Czarnowska, Anna [Thu, 17 Feb 2011 22:46:00 +0000 (22:46 +0000)] 
fix: memory leak in Create

match_metadata_desc allocates memory for st
which is not needed after validate_geometry fails

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomodified message on failure to read metadata in Manage
Czarnowska, Anna [Thu, 17 Feb 2011 22:43:19 +0000 (22:43 +0000)] 
modified message on failure to read metadata in Manage

Loading container may fail if e.g. one of the disks in container
has been detached but udev has not realized the change.
Addition to such array will fail because reading superblock
from one of disks in array fails.
Current message is a bit confusing.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoTeach --assemble --force to handle reshapes a little better.
NeilBrown [Mon, 21 Feb 2011 00:41:01 +0000 (11:41 +1100)] 
Teach --assemble --force to handle reshapes a little better.

When we force-assemble an array which is in the middle of a reshape,
we should repeat the reshape of any parts that aren't recorded in
the oldest superblock.

This is unlikely to make a significant difference, but could make
a small difference, and is safer.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: sysfs_disk_to_scsi_id() adapted to current sysfs format
Krzysztof Wojcik [Fri, 18 Feb 2011 12:51:34 +0000 (23:51 +1100)] 
FIX: sysfs_disk_to_scsi_id() adapted to current sysfs format

Problem: sysfs_disk_to_scsi_id() not returns correct scsi_id value.
Reason: sysfs format has been changed

This patch adapt sysfs_disk_to_scsi_id() to new sysfs format.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoUser space RAID-6 access fix
Piergiorgio Sartor [Fri, 18 Feb 2011 12:51:19 +0000 (23:51 +1100)] 
User space RAID-6 access fix

> I have applied some patch - with some formatting changes to make it consistent
> with the rest of the code.
>
> I don't really have time to look more deeply at it at the moment.
> Maybe someone else will?...

Hi Neil,

thanks for including this in git.

Actually I did it look at it :-) and I already found a
couple of issues, below is a small fix patch.

Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Seg Fault in incremental if BBM log detected
Krzysztof Wojcik [Fri, 18 Feb 2011 12:51:17 +0000 (23:51 +1100)] 
FIX: Seg Fault in incremental if BBM log detected

Bug  detected for imsm metadata.
Assembling of array using Incremental switch generate segmentation
fault if BBM log is detected.
Reason: missing return from Incremental_container if BBM is detected
and unnecessary list=NULL assignment.
This patch fix the problem and memory leak in this area.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agomdadm.man add encouragement to shrink filesystem before shrinking array.
NeilBrown [Tue, 15 Feb 2011 01:40:21 +0000 (12:40 +1100)] 
mdadm.man add encouragement to shrink filesystem before shrinking array.

Before resizing an array with --size or --array-size, then filesystem
should be resized.  mdadm cannot do this so the user should.

Reported-by: Gavin Flower <gavinflower@yahoo.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix regression with removing 'failed' and 'detached' devices.
NeilBrown [Mon, 14 Feb 2011 23:45:01 +0000 (10:45 +1100)] 
Fix regression with removing 'failed' and 'detached' devices.

If a request to remove all 'failed' or 'detached' devices chooses to
remove the first device, it will not actually try the removal and will
skip any following devices.

This fixes it.

Reported-by: Rémi Rérolle <rrerolle@lacie.com>
Tested-by: Rémi Rérolle <rrerolle@lacie.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agofix extended partition detection
Dan Williams [Tue, 25 Jan 2011 02:54:06 +0000 (18:54 -0800)] 
fix extended partition detection

# mdadm --detail --export /dev/md127p1

Before:
MD_LEVEL=raid5
MD_DEVICES=4
MD_METADATA=0.90

After:
MD_LEVEL=raid5
MD_DEVICES=4
MD_CONTAINER=/dev/md0
MD_MEMBER=0
MD_UUID=55746a20:925d24a7:4f9bd7e2:9c9a411f

We parse the symlink target with a format:

../../block/mdXXX/mdXXXpYY

...and need the second '/' from the end of the string to read detect a
'md' device.

Reported-by: Krzysztof Wasilewski <krzysztof.wasilewski@intel.com>
Cc: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFix regression with removing 'failed' and 'detached' devices.
NeilBrown [Mon, 14 Feb 2011 23:45:01 +0000 (10:45 +1100)] 
Fix regression with removing 'failed' and 'detached' devices.

If a request to remove all 'failed' or 'detached' devices chooses to
remove the first device, it will not actually try the removal and will
skip any following devices.

This fixes it.

Reported-by: Rémi Rérolle <rrerolle@lacie.com>
Tested-by: Rémi Rérolle <rrerolle@lacie.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoanalyse_change: fix calculation of after.data_disks and ->delta_disks.
NeilBrown [Mon, 14 Feb 2011 01:17:08 +0000 (12:17 +1100)] 
analyse_change: fix calculation of after.data_disks and ->delta_disks.

When changing level when a new number of raid disks was explicitly
specified, we much make sure that the change implied by the
change in level is properly incorporated into the final result.

So explicitly track the change in number of parity disks
(delta_parity) and use it together with delta_disks to determine
final data_disks.
Also set info->delta_disks so other code doesn't need to mirror
this analysis.

And add some errors in cases where a new number of disks was
requested but is not currently supported

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Add raid5 to raid0 case to analyse_change()
Adam Kwolek [Mon, 14 Feb 2011 00:15:48 +0000 (11:15 +1100)] 
FIX: Add raid5 to raid0 case to analyse_change()

Transition raid5 to raid0 was not covered in analyse_change()
Missing case added.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: FIX: Add spare disks information to array description
Adam Kwolek [Mon, 14 Feb 2011 00:09:22 +0000 (11:09 +1100)] 
imsm: FIX: Add spare disks information to array description

Spares that are specified on container can be used by any array in container.
this means that for every array in container they should be reported.
This let caller know how many spare devices (not used in any array)
are still available.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: Get spares from external metadata
Adam Kwolek [Mon, 14 Feb 2011 00:06:31 +0000 (11:06 +1100)] 
FIX: Get spares from external metadata

For external metadata cases, information about number of spares cannot
be get via ioctl GET_ARRAY_INFO for particular array
(as info variable is initialized by). In md this information is present
in container object not array one.
This causes need to get spare disks number from external metadata.

This information is required for reshape_array() function to decide
if spare disks number satisfy operation requirements.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoFIX: delta_disk can have UnSet value
Adam Kwolek [Mon, 14 Feb 2011 00:04:09 +0000 (11:04 +1100)] 
FIX: delta_disk can have UnSet value

Delta_disk can be set to UnSet value.
This can a cause to pass wrong parameter to reshape_super().
To avoid such situations raid_disks and delta_disks parameters
have to be passed to reshape_super() separately.
It will be up to reshape_super() function validation
and usage of this parameters to avoid not valid values.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agofix: imsm: assemble doesn't restart recovery
Czarnowska, Anna [Sun, 13 Feb 2011 22:27:43 +0000 (09:27 +1100)] 
fix: imsm: assemble doesn't restart recovery

Because IMSM_ORD_REBUILD is set in second map not first.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agofix: imsm: size must be in K for rounding to chunk
Czarnowska, Anna [Sun, 13 Feb 2011 22:27:09 +0000 (09:27 +1100)] 
fix: imsm: size must be in K for rounding to chunk

chunk is in K so size must be converted to K before it is rounded.
Otherwise we may get wrong freesize returned
resulting in creation failure.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
14 years agoimsm: Add information about failed disk to '-E' option
Adam Kwolek [Sun, 13 Feb 2011 22:25:57 +0000 (09:25 +1100)] 
imsm: Add information about failed disk to '-E' option

During metadata printout in '-E' option failed disk map field
information is missing.  Add this information to mdadm '-E' option
output.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>