Commit Graph

352 Commits

Author SHA1 Message Date
Adam Kwolek b8063f0770 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>
2011-03-10 09:57:39 +11:00
NeilBrown 4968025884 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>
2011-03-08 17:14:00 +11:00
Adam Kwolek 588bebfcc2 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>
2011-03-02 12:28:15 +11:00
Adam Kwolek 882029c86d 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>
2011-02-27 17:26:42 +11:00
NeilBrown 71204a5029 Various compile fixes.
Make "make everything" succeed.
This fixed some real bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 15:48:03 +11:00
NeilBrown a5d10dcec8 Allow explicitly listed spared to be included by default.
When the metadata doesn't identify which array a spare belongs to
we normally require an explicit domain match to connect a spare
with an array.
However when the spare is explicitly listed in argv, it should be
safe to include as long as there is no domain conflict.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 14:44:02 +11:00
NeilBrown e5508b361d Allow domain_test to report that no domains were found.
Sometime we will need to know the difference between no domains found
and domains didn't match.
So allow domain_test to return different values and fix up all callers
to maintain current behaviour.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 14:44:02 +11:00
NeilBrown ac597b1c21 free_super after assembling a container
Else the devices are held open.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 13:07:24 +11:00
NeilBrown d438679977 Assemble: ignore unknown devices not listed on command line.
If we find a device that has not superblock, we currently fail
unless in auto_assem mode.
However we really should only fail if the device was explicitly listed
in the arg list.  So add a test for that.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 13:07:07 +11:00
Czarnowska, Anna 3c7b4a2595 Assemble: allow to assemble container with uuid=0:0:0:0
When there are any arrays in config file the spares with
domain not matching any array are not assembled because
auto assembly is not attempted.
Addition of ARRAY line with uuid=0:0:0:0 in config will work
with modified condition for gathering spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-02-01 10:40:56 +11:00
Anna Czarnowska ed7fc6b4d9 Assemble: allow to assemble spares on their own
If we find spares but no members of given array
we create container with just spares.

This allows auto assemble to pick up all lose imsm spares when there
is no config file.
When there is a valid config file and any array is assembled from it
we don't try auto assembly so we will not assemble spares that don't
match any array.
To remedy this we must add
ARRAY metadata=imsm UUID=00000000:00000000:00000000:00000000
to config file.
This container will include all remaining spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 13:54:18 +11:00
Anna Czarnowska 26b05aeaed Assemble: we need to read policy to know array domains
Policy must be read on all disks identified as array members
to get array's domains list.
Currently it is only read on first array member in auto assembly mode.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-01-05 13:42:59 +11:00
Anna Czarnowska cbeeb0e5f0 Assemble imsm spares in matching domain only
Imsm spare will only be taken if it matches domain of
identified members of currently assembled array.

This implies that:
- spare with null domain will match first array assembled.
- if array has null domain then no spare will match

If we allow spares to set st they may block assembly of subarrays.
This is because in auto-assembly tmpdev->used=0 for a spare not matching
any array. If we find such spare before container and set st, the content
will not get assembled.

We allow uuid_zero match any uuid in assembly as unsuitable spares will
be rejected on domain check.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-26 22:08:51 +11:00
Krzysztof Wojcik a06d022db4 FIX: Bad block verification during assembling array
We need to refuse to assemble an arrays with bad blocks.
Initially there was condition in container_content function
that returns error value in the case when metadata store information
about bad blocks.
When the container_content function is called from functions NOT connected
with assemble (Kill_subarray, Detail) we get faulty error return value.
Patch introduces new flag in array.status - MD_SB_BBM_ERRORS. It is set
in container_content when bad blocks are detected and can be checked by
container_content caller.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-26 21:41:57 +11:00
NeilBrown 87f26d14f7 Assemble: allow an array undergoing reshape to be started without backup file
Though not having the proper backup file can cause data corruption, it
is not enough to justify not being able to start the array at all.
So allow "--invalid-backup" to be specified which says "just continue
even if a backup cannot be restored".

Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-01 11:47:32 +11:00
Hawrylewicz Czarnowski, Przemyslaw 417f346ee0 fix: assemble for external metadata generates segfault if invalid device found
An attempt to invoke super_by_fd() on device that has
metadata_version="none" always matches super0 (as test_version is "").
In Assemble() it results in segfault when load_container is invoked
(=null for super0).
As of now load_container is only started if it points to valid pointer.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-01 11:06:09 +11:00
NeilBrown 484ae54d16 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>
2010-11-30 16:56:01 +11:00
Dan Williams dcc4210f58 Assemble: fix assembly in the delta_disks > max_degraded case
Incremental assembly works on such an array because the kernel sees the
disk as in-sync and that the array is reshaping.  Teach Assemble() the
same assumptions.

This is only needed on kernels that do not initialize ->recovery_offset
when activating spares for reshape.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-23 15:10:01 +11:00
NeilBrown 87477e6d5e Assemble: get content before testing it.
When checking that a container matches the required uuid,
we need to call 'getinfo_super' before we have a 'content'
to test.

Reported-by: "Czarnowska, Anna" <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-23 11:34:36 +11:00
NeilBrown 5083d66b9c Assemble: use load_container
Separate the load_container call from the load_super call,
and use different validity tests as appropriate.

Add some general code tidying and a bit of indent change to make
structure a little clearer.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:06 +11:00
NeilBrown 88cef9b3e6 Assemble: turn next_member goto loop into a for loop.
It becomes much clearer what is happening now.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:06 +11:00
NeilBrown 02c2c47487 Assemble: simplify the handling of is_member_busy.
This is somewhat inconsistent with the last member of a
container getting special handling.
Just simplify it so the code seems to make sense and important
is easy to follow.

Signed-of-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:06 +11:00
NeilBrown d76c4d8894 Assemble: remove the skip variable.
it seems we don't need it any more

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:06 +11:00
NeilBrown 805d30b288 Assemble: merge 'member' test into ident_matches.
This is a more sensible place for it, gathering all the tests
together.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown fa0312397e Assemble: change 'skip' label to a variable.
This gets rid of some gotos which makes the code flow a bit
more clear.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown 2b594614a1 Remove content from mddev_dev
Now that the next_member loop is much smaller it is easy to
just use 'content' rather than stashing it in 'tmpdev->content'.
So we can remove the 'content' field from 'struct mddev_dev'.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown 1415fe4b6c Assemble: contract next_member loop.
We have a 'goto next_member' loop which is rather spread-out and
confusing.
Recent refactoring make it possible to contract that loop
significantly.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown bac0d92e93 Assemble: merge to large 'if' statements.
In assemble, we see (inside a 'for' loop):

 if (condition) {
    lots of stuff
 } else
    something

 small thing

 if (same condition) {
     lots more stuff
     break;
 }

where 'condition' cannot be changed in the middle.

So simplify this to

 if (condition) {
    lots of stuff
    small thing
    lots more stuff
    break;
 }

 something
 small thing

which duplicates the small thing, but provides much
conceptual simplicity.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown a655e55064 Improve type names for mddev_dev
Remove the _t pointer typedef and remove the _s suffix for the
structure,

These things do not help readability.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown fa56eddbd1 Improve mddev_ident type definitions.
Remove the _t typedef and remove the _s suffix from the struct name.

These things do not help readability.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown 08fb91a363 Assemble: factor out ident_matches
This will help future patch, and we need to make "Assemble()" smaller
anyway.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown d68ea4d775 Assemble: small cleanup of error checking.
If we get an early error (e.g. not a block device) we need to
not continue through and check e.g. uuid.

Also make sure we set used=2 whenever we find an error, and don't
bother with ->free_super as 'goto loop' does that.

Now that we abort earlier, we can remove lots of tests on
  tst && tst->sb


Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:58:05 +11:00
NeilBrown 00bbdbdac6 Add subarray arg to container_content.
This allows the info for a single array to be extracted,
so we don't have to write it into st->subarray.

For consistency, implement container_content for super0 and super1,
to just return the mdinfo for the single array.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:26 +11:00
NeilBrown 02e7c5b75c Assemble - avoid including wayward devices.
If a device - typically in a mirrored set - is assembled independently
of the other devices, and then attempted to be brought back into the
set it could contain inconsistent data.  It should not be included.

So detect this situation by ensuring that the 'most recent' device is
believed to be active by every other device.  If a device is wayward,
it will only consider fellow wayward devices to be active and will
think all others are failed or missing.

This patch only fixes --assemble, not --incremental

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown d7f7ebb73d Assemble: handle devices array better.
Only allocate when it is about to be used, and free it when finished.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown a5d85af748 get_info_super: report which other devices are thought to be working/failed.
To accurately detect when an array has been split and is now being
recombined, we need to track which other devices each thinks is
working.

We should never include a device in an array if it thinks that the
primary device has failed.

This patch just allows get_info_super to return a list of devices
and whether they are thought to be working or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown 1e2b276535 Report error in --update string is not recognised.
If an --update is requested by the relevant metadata doesn't
understand it, print a useful message rather than silently ignoring
the issue.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:24 +11:00
NeilBrown 4e8d9f0a16 Convert 'auto' config line to policy statements 2010-09-06 11:26:28 +10:00
NeilBrown 0f22b998fb Add mbr pseudo metadata handler.
To support incorpating a new bare device into a collection of arrays -
one partition each - mdadm needs a modest understanding of partition
tables.
The main needs to be able to recognise a partition table on one device
and copy it onto another.

This will be done using pseudo metadata types 'mbr' and 'gpt'.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-09-06 11:26:28 +10:00
NeilBrown 7e83544bc4 Use action policy to keep recently-disconnected devices in the array.
When we find a device that was recently part of the array but is now
out of date (based on the event count) we might want to add it back in
(like --re-add) if the likely cause was a connection problem or we
might not if the likely cause was device failure.

So make this a policy issue: if action=re-add or better, try to re-add
any device that looks like it might be part of the array.

This applies:
  when we assemble the array:  old devices will be evicted by the
     kernel and need to be re-added.
  when we assemble the array during --incr for the same reason.
  when we find a device that could be added to a running array.

This doesn't affect arrays with external metadata at all.
For such arrays:
 When the container is assembled, the most recent instance of each
 device is included without reference to whether it is too old or not.
 Then the metadata handler must which slices of which devices to
 include in which array and with what state.  So the
 ->container_content should probably check the policy and compare the
 sequence numbers/event counts.
 When a device is added (--add) to a container with active arrays
 we only add as a 'spare'. --re-add doesn't seem to be an option.
 When a device is added with -I ->container_content gets another
 chance to assess things again.  So again it should check the policy.


Signed-off-by: NeilBrown <neilb@suse.de>
2010-09-06 11:26:27 +10:00
NeilBrown f21e18ca89 Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 13:13:02 +10:00
NeilBrown e5c99c0811 Assemble: Fix honouring of 'auto' config line
commit 1ff9833928
broke the checking of metadata types via the 'auto' line.

Be moving 'load_super" before "conf_test_metadata" we left
tst->sb set even if conf_test_metadata fails, so the device will
actually be accepted and used.

So if we decide to reject the device, free the superblock so it is
clear that it is rejected.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-07-06 11:57:09 +10:00
NeilBrown 1ff9833928 Assemble: fix some recently introduced bugs.
Found during testing:
 - cannot check metadata for homehost before loading metadata.
 - As 1.x metadata can has a state 'rebuilding' between
   'spare' and 'ok', we need to include that in our calculations.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 11:21:40 +11:00
NeilBrown d1d3482b56 config: add 'homehost' option to 'AUTO' line.
This allows basing auto-assembly decisions on whether
the array is recorded as belonging to this host or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 14:33:55 +11:00
NeilBrown 24af7a8744 Assemble: clean up properly if we cannot add the bitmap file.
If we find we cannot add the requested bitmap file when
assembling the array, then make sure to clean up properly
and don't leave a half-configured array.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-02-24 12:17:17 +11:00
NeilBrown 4c1c3ad8cf Assemble: check inargv before complaining about stray arguments.
If --assemble is given a container and some other devices to assemble
an array from, it complains with an error because that doesn't make
sense.
However it currently also complains if the list of devices was extract
from the config file rather than being given on the command line.
That is not appropriate.

So add an '&& inargv' test to ensure that we are really complaining
about the right thing.

Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
2010-02-24 11:43:59 +11:00
NeilBrown 921d9e164f Assemble: fix --force assembly of v1.x arrays which are recovering.
1.x metadata allows a device to be a member of the array while it
is still recoverying.  So it is a working member, but is not
completely in-sync.

mdadm/assemble does not understand this distinction and assumes that a
work member is fully in-sync for the purpose of determining if there
are enough in-sync devices for the array to be functional.

So collect the 'recovery_start' value from the metadata and use it in
assemble when determining how useful a given device is.

Reported-by: Mikael Abrahamsson <swmike@swm.pp.se>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-02-04 12:02:09 +11:00
NeilBrown 9f22b13fe1 Assemble: error-check ->load_super
Once load_super has succeeded, it should continue to succeed.  However
devices can disappear etc so it is prudent to always check the return
status of load_super.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-01-28 09:02:21 +11:00
NeilBrown cd77ac4eaf Assemble: fix testing of 'verbose' flag.
The 'verbose' flag can be negative, meaning 'quiet'.
So never check for != 0.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-19 15:55:59 +11:00
NeilBrown df0d4ea04e Replace all relevant occurrences of -4 with LEVEL_MULTIPATH
Also -1 -> LEVEL_LINEAR.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 12:31:12 +11:00
NeilBrown f22385f982 Assemble: include ACTIVE but not in-sync devices as non-spares.
Previously such things did not exist: ACTIVE and SYNC were either both
set or both clear.   Recent changes with reshape means that a device
can be ACTIVE but not yet fully in-sync, so they need to be handled
and included in the array as active devices.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 12:30:54 +11:00
NeilBrown 4a997737a1 Merge branch 'master' into devel-3.1 2009-10-22 11:13:13 +11:00
NeilBrown eb3929a47f Compile fixes for mdassemble
Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-20 16:53:43 +11:00
NeilBrown ea0ebe9685 Assemble: print more verbose messages about restarting a reshape
Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-20 16:23:45 +11:00
NeilBrown 8a0a0ded4a Assemble: handle container members better
When looking for a specific member, don't accept a
different member, but step on to the next one.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-19 17:08:04 +11:00
NeilBrown 7636b5a8bb Assemble: print verbose messages when finding members in containers
.. so that "-Av" gives more hints at what is going on.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-19 17:04:12 +11:00
Dan Williams 6e46bf344b imsm: add --update=uuid support
When disks have conflicting container memberships (same container ids
but incompatible member arrays) --update=uuid can be used to move
offenders to a new container id by changing 'orig_family_num'.

Note that this only supports random updates of the uuid as the actual
uuid is synthesized.  We also need to communicate the new
'orig_family_num' value to all disks involved in the update.  A new
field 'update_private' is added to struct mdinfo to allow this
information to be transmitted.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-10-13 17:41:53 -07:00
NeilBrown ca4f89a3b7 Merge branch 'master' into devel-3.1
Conflicts:
	mdadm.8
2009-10-01 16:58:40 +10:00
NeilBrown e9e43ec367 Grow: support restart of new migrations. 2009-08-13 11:12:54 +10:00
Dan Williams 3ef383aa96 Assemble: fix handling of empty container
# mdadm --create /dev/md/ddf /dev/sd[b-e] -n 4 -e ddf
mdadm: container /dev/md/ddf prepared.
# mdadm -Ss
mdadm: stopped /dev/md126
# mdadm -As
mdadm: Container /dev/md/ddf0 has been assembled with 4 drives
Segmentation fault

Reported-by: Artur Wojcik <artur.wojcik@intel.com>
Reported-by: Jacek Danecki <jacek.danecki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-08-04 10:17:23 -07:00
NeilBrown e736b62389 Update copyright dates and remove references to @cse.unsw.edu.au
Also removed 'paper' addresses.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-06-02 14:35:45 +10:00
NeilBrown e0fe762a63 mdadm.8: Man page updates
General review and update of mdadm.8
2009-06-02 14:06:05 +10:00
NeilBrown 7cdc087234 Be more consistent about keeping the host: prefix on array names.
If an array name contains a "hostname:" prefix, then
--assemble will tend to leave it there, while --incremental
will strip it off (when chosing a device name during auto-assembly).

Make this more consistent:  strip the name off if we decide that
the name will be treated as 'local'.  Leave it on if it will be
treated as 'foreign'.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:47:10 +10:00
NeilBrown 0ac91628b9 Allow homehost to be largely ignored when assembling arrays.
If mdadm.conf contains
   HOMEHOST <ignore>
or commandline contains
   --homehost=<ignore>

then the check that array metadata mentions the given homehost is
replace by a check that the name recorded in the metadata is not
already used by some other array mentioned in mdadm.conf.

This allows more arrays to use their native name rather than having
an _NN suffix added.

This should only be used during boot time if all arrays required for
normal boot are listed in mdadm.conf.

If auto-assembly is used to find all array during boot, then the
HOMEHOST feature should be used to ensure there is no room for
confusion in choosing array names, and so it should not be set
to <ignore>.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:46:46 +10:00
NeilBrown 05833051ee Assemble/Incr : minor tidy up of setting 'trustworthy'.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:19:30 +10:00
NeilBrown aa7c284c06 Fix tests on ->container and ->member
For container= and member= to be effective in an mdadm.conf line
they must both be present.  So when checking for their absence we
need container != NULL || member != NULL.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:18:25 +10:00
NeilBrown 31015d5798 conf/assemble: new config line "auto".
The line 'auto' in mdadm.conf can be used to disable assembly
of specific metadata types, or of all arrays.

This does not affect assembly of arrays listed in mdadm.conf
or on command line.

 auto -all

will disable all auto-assembly.

 auto -ddf

will cause mdadm to ignore ddf arrays that are not explicitly
mentioned, and auto assemble anything else it finds.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:17:33 +10:00
NeilBrown 745f72f61a assemble: support arrays created with --homehost=any
If an array is created with --homehost=any, then --assemble and
--incremental will treat it as being local to 'this' host, no matter
what the name of this host is.

This is useful for array that will be given unique names and be
moved between machines.

This needs to be documented.

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

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

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-14 10:19:02 +10:00
NeilBrown 8b4e5ea926 Assemble: call map_update even when not starting the array.
For incremental assembly to work, we need to keep the 'map'
up-to-date even when not starting the array yet.

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

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


Signed-off-by: NeilBrown <neilb@suse.de>
2009-03-10 16:28:22 +11:00
Dan Williams 66afdfa977 Assemble: fix busy detection
Use mddev_busy() as GET_ARRAY_INFO can succeed on 'clear' arrays.

Ran into this after an encountering a case where mdadm -Ss ended in
segfault (missing check for NULL return from map_by_devnum() in
sles11:Manage.c).  So, tried to stop the array by hand with echo clear >
md/array_state, after which I could not reassemble since GET_ARRAY_INFO
was succeeding.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:50 -07:00
NeilBrown 45b662b611 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-12-18 16:58:25 +11:00
NeilBrown 8a659c3321 Merge branch 'master' into devel-3.0
Conflicts:

	Assemble.c
	Incremental.c
	Kill.c
	ReadMe.c
	inventory
	mapfile.c
	mdadm.8
	mdadm.spec
	mdassemble.8
2008-12-18 16:56:13 +11:00
NeilBrown acee8e8964 Assemble: set stripe_cache_size properly when restarting a reshape.
Reshape with large chunk size can require a large stripe_cache.
We make this work when starting the reshape but not when
restarting at assemble time.  So fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 14:24:41 +11:00
NeilBrown 4e9a6ff778 Assemble: don't assume array is 'clean' unless all devices think it is.
This is only significant for --assemble --force where some old
devices might be included into the array.  If anything looks like
it isn't clean, the kernel will not allow a degraded array to be started.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-12-18 14:11:59 +11:00
Dan Williams 959278735e wait_for container assembly
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:17 -07:00
NeilBrown 5a52a34090 Merge branch 'master' into devel-3.0 2008-11-27 15:48:45 +11:00
NeilBrown d555f10146 Assemble: allow --force to work even when event counts are 0.
If any superblocks in a confused array had an event count of 0,
"mdadm -Af" would not update the event counts to assemble the array.
I don't remember why that text is there, and it has caused at least
one situation to be difficult to recover from.  So remove the
test.  --force means --force!

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-27 15:46:51 +11:00
NeilBrown 78b958e205 Assemble: wait for device to appear via udev
Use the new "wait_for" function to make sure udev has created
the device before completion the 'assemble'.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-27 15:43:22 +11:00
NeilBrown 4408ee768b Assemble: close mdfd before returning from assemble_container_content
This makes sure it is consistently closed.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-07 22:15:14 +11:00
NeilBrown 7cb2aa33e5 Assemble: return correct status from assemble_container_content.
Otherwise autoassembly can get confused.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-07 21:49:20 +11:00
NeilBrown f7ad3ccc77 Assemble: fix some auto-assemble bugs.
1/ when we choose not to use a device, must set ->used to 2, not 1.
2/ When we give up on a member, clear st and content.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-07 21:49:08 +11:00
NeilBrown a714580e02 Wait for name to appear after create/assemble etc.
We don't really want mdadm to exit until udev has
created the names in /dev.  So wait.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 21:56:42 +11:00
NeilBrown 56a8da69b1 Assemble: we were missing a 'close'
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown f05641cf7a Assemble: revise detection of 'autoassemble' mode.
We probably should pass a flag down saying 'this is auto-assembly',
but for now, if there is no identity information set, it must
be auto-assemble.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown 9008ed1c96 Assemble: allow members of containers to be assembled and auto-assembled.
Try to treat members of containers much like other arrays for
assembly.
We still look through the list of devices for a match (it will be
the container), then find the relevant 'info' and try to assemble
the array.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
NeilBrown 52437b4f08 Assemble: simplify test for reporting mismatches.
Rather than open-coding a test of 'verbose' and 'inargv' in
multiple places, do it one and set a variable.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
Dan Williams 2de8884f0f Assemble: block attempts to reassemble container members
Attempting to open(O_EXCL) each candidate device usually filters out all
busy raid components.  However, containers do not behave like components
and will return container_content that may describe active member
arrays.

This patch just adds a function that will be used to check if a
container member is busy.  It will be used shortly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
Dan Williams 6234c63ccc Assemble: factor out assemble_container_content
Factor out, from Incremental_container,  the code for assembling an
array based on information extracted from a container.  We will
shortly use this from Assemble too.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:11 +11:00
Dan Williams ce744c97bc Assemble: revert preliminary -As support
I have seen the light.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-11-04 20:51:11 +11:00
Dan Williams 98dbd96605 Assemble: replace 'info' with 'content'
In preparation for handling the container case where we may need to handle
a list of potential member arrays.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:06 +11:00
Dan Williams 197e3eb690 Quiet unitialized variable warnings
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown ac2ecf5543 assemble: fix setting of 'foreign' trustability. 2008-11-04 20:50:39 +11:00
NeilBrown a4bc1720ff Assemble: Fix naming of container devices.
Container devices are meant to be named for the metadata type.
That wasn't happening properly for DDF.


Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown 9759037678 Generate 'change' uevents when arrays change in non-obvious ways.
When a 'container' gets started, we need udev to notice, but the
kernel has no way of knowing that a KOBJ_CHANGE event is needed.  So
send one directly via the 'uevent' sysfs attribute.

Also, uevents don't get generated when md arrays are stopped (prior to
2.6.28) so send 'change' events then too.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown a04d576343 Always update mdadm/map when starting an array.
We previously only updated /var/run/mdadm/map when starting an
array with --incremental.  However we now make more use of
that file (to pass the dev name to udev) so always update it.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:38 +11:00
NeilBrown 215bb3f776 Incremental: adjust to the new naming scheme.
--incremental now uses exactly the same create_mddev that
other code uses.
2008-11-04 20:50:38 +11:00
NeilBrown 69207ff6ac mdopen: Introduce new rules for creating device name.
MORE CONTENT HERE
2008-11-04 20:50:21 +11:00
NeilBrown c30e53693e assemble: combine the two create_mddev calls in to one.
This delays the create_mddev call even further in the case where
an array device name is given for --assemble.  It is now delayed
until the 'name' of the array is also available.
2008-11-04 10:35:42 +11:00
NeilBrown 7f91af49ad Delay creation of array devices for assemble/build/create
We will shortly be feeding more information into the process of
creating array devices, so delay the creation.  Still open them
early if the device already exists.

This involves making sure the autof flag is in the right place
so that it can be found at creation time.

Also, Assemble, Build, and Create now always close 'mdfd'.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 10:35:37 +11:00
NeilBrown 2399204ddd Rename open_mddev to create_mddev
This reflect that fact that more often than not it is creating things
in /dev, and allows for a new open_mddev which does just that.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 10:35:10 +11:00
Dan Williams 71d60c480a Preliminary -As support for container member arrays
Given an mdadm.conf like the following allow /dev/imsm and /dev/md/r1 to be
created by "mdadm -As".

DEVICES partitions 
ARRAY /dev/imsm metadata=imsm auto=md UUID=b98f5dbe-aa859e7b-0e369b89-a80986d4 
ARRAY /dev/md/r1 container=/dev/imsm member=0 auto=mdp UUID=3538e39c-b397c2e9-1aa031f9-2bc0eca4 
   spares=1

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-28 10:55:31 -07:00
Dan Williams 57ed8c9155 Treat all devices at the container level as spares
Raid disk and disk number information is not relevant at the container
level, especially for imsm.  So arrange for getinfo_super_imsm() to
always publish devices as spares and report the number of spares at
Assemble() time.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:43:57 -07:00
Dan Williams 3d2c4fc7b6 trivial warn_unused_result squashing
Made the mistake of recompiling the F9 mdadm rpm which has a patch to
remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots
of errors:

config.c:568: warning: ignoring return value of asprintf
Assemble.c:411: warning: ignoring return value of asprintf
Assemble.c:413: warning: ignoring return value of asprintf
super0.c:549: warning: ignoring return value of posix_memalign
super0.c:742: warning: ignoring return value of posix_memalign
super0.c:812: warning: ignoring return value of posix_memalign
super1.c:692: warning: ignoring return value of posix_memalign
super1.c:1039: warning: ignoring return value of posix_memalign
super1.c:1155: warning: ignoring return value of posix_memalign
super-ddf.c:508: warning: ignoring return value of posix_memalign
super-ddf.c:645: warning: ignoring return value of posix_memalign
super-ddf.c:696: warning: ignoring return value of posix_memalign
super-ddf.c:715: warning: ignoring return value of posix_memalign
super-ddf.c:1476: warning: ignoring return value of posix_memalign
super-ddf.c:1603: warning: ignoring return value of posix_memalign
super-ddf.c:1614: warning: ignoring return value of posix_memalign
super-ddf.c:1842: warning: ignoring return value of posix_memalign
super-ddf.c:2013: warning: ignoring return value of posix_memalign
super-ddf.c:2140: warning: ignoring return value of write
super-ddf.c:2143: warning: ignoring return value of write
super-ddf.c:2147: warning: ignoring return value of write
super-ddf.c:2150: warning: ignoring return value of write
super-ddf.c:2162: warning: ignoring return value of write
super-ddf.c:2169: warning: ignoring return value of write
super-ddf.c:2172: warning: ignoring return value of write
super-ddf.c:2176: warning: ignoring return value of write
super-ddf.c:2181: warning: ignoring return value of write
super-ddf.c:2686: warning: ignoring return value of posix_memalign
super-ddf.c:2690: warning: ignoring return value of write
super-ddf.c:3070: warning: ignoring return value of posix_memalign
super-ddf.c:3254: warning: ignoring return value of posix_memalign
bitmap.c:128: warning: ignoring return value of posix_memalign
mdmon.c:94: warning: ignoring return value of write
mdmon.c:221: warning: ignoring return value of pipe
mdmon.c:327: warning: ignoring return value of write
mdmon.c:330: warning: ignoring return value of chdir
mdmon.c:335: warning: ignoring return value of dup
monitor.c:415: warning: rv may be used uninitialized in this function

...some of these like the write() ones are not so trivial so save those
fixes for the next patch.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
NeilBrown ff54de6e47 Report uuid in --detail --brief for ddf and intel
The uuid is slightly fictitious but needed for array matching.
2008-09-18 16:11:40 +10:00
NeilBrown d7288ddc3a Use uuid as /dev name when assembling array of uncertain origin.
If we aren't sure that the array belongs to 'this' host, use the
uuid to choose a name to avoid any conflict.
2008-09-18 16:08:10 +10:00
NeilBrown 9362c1c80c Allow metadata handler to report that it doesn't record homehost.
For now, this means that the lack of a homehost doesn't always prevent
assembly.
Soon we will allow assembly anyway, but have different messages if
homehost isn't supported.
2008-09-18 16:06:41 +10:00
NeilBrown f35f252592 Move calls to SET_ARRAY_INFO to common helper.
When we assemble an array, there are three different approaches
depending on whether metadata is internal or external, and on
kernel version.

Move all this to a common helper instead of duplicating in 3 places.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 16:01:55 +10:00
NeilBrown 7801ac2092 Factor out add-disk code
The variety of approaches to 'add_disk' are factored out into
a separate function, and Incremental mode benefits by being
closer to supporting the assembly of containers.

Also remove the adding-to-array-data-structure out of sysfs_add_disk
and into add_disk.

And add some tests for --incremental mode to make sure we don't break it.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 15:13:32 +10:00
NeilBrown 0e60042683 Compile fixes, particularly moving more stuff under MDASSEMBLE
Now 'make everything' works again.
2008-09-18 15:04:47 +10:00
Neil Brown d2ca644994 Remove getinfo_super_n and do some other cleaning up.
Getting close to a sensible description of what some of the
superswitch methods are supposed to do!
2008-07-12 20:27:39 +10:00
Neil Brown b8ac196795 Remove 'major' from superswitch.
It isn't generally meaningful.
2008-07-12 20:27:37 +10:00
Neil Brown 370ac380fd Merge branch 'master' into devel-3.0
Conflicts:

	Makefile
2008-06-19 16:38:37 +10:00
Chris Webb 60b435db5a Fix bug in forced assemble.
From: Chris Webb <chris@arachsys.com>

We are loading into the already-loaded 'st' instead of the
newly create 'tst', which is clearly wrong.
2008-06-19 16:30:39 +10:00
Neil Brown 3d2b16e77c Avoid NULL reference calling free_super and elsewhere.
Since we made free_super a superswitch call, we need to be careful
that st is non NULL before calling st->ss->free_super(st).
Also when updating byteorder there is a chance of a similar NULL
deref.
2008-05-27 17:23:16 +10:00
Neil Brown fe2979bd16 Remove stray semicolon
Causes compile error with gcc-2.95
2008-05-27 17:23:09 +10:00
Neil Brown 159c3a1a77 Remove st->text_version in favour of info->text_version
I want the metadata handler to have more control over the 'version',
particularly for arrays which are members of containers.
So discard st->text_version and instead use info->text_version
which getinfo_super can initialise.
2008-05-27 09:18:55 +10:00
Neil Brown 2318b9f0dc Remove 'fd' arg from sysfs_add_disk
It it never used, and removing means there are several 'open's that can
go.
2008-05-27 09:18:32 +10:00
Neil Brown 30e1b9a585 Remove stray semicolon
Causes compile error with gcc-2.95
2008-05-27 09:18:31 +10:00
Neil Brown 1c203a4b5a Fix autoassemble for stack arrays.
If you have stacked arrays, then
  mdadm -As --homehost=fred
should work but doesn't.  It gets into an infinite loop!

So write some tests, and fix the bugs.
2008-05-20 16:28:48 +10:00
Neil Brown 598f0d58ac Can now mostly assemble DDF arrays 2008-05-15 16:48:19 +10:00
Neil Brown a19c88b83d Start on --assemble support for DDF 2008-05-15 16:48:18 +10:00
Neil Brown ddd1a49251 Avoid possible null dereference in Assemble.
If the first device we look at has no superblock,
there is no 'st' to free, so don't free it.
2008-05-15 15:50:42 +10:00
Neil Brown 213ee40bd2 Some tidy up of 'devices' in assemble.
use "mdinfo" in the devices list rather than just copying
ad-hoc fields in.
2007-12-14 20:14:53 +11:00
Neil Brown 61255666e2 Don't record oldmajor/oldminor any more during assemble.
We don't use the information at all (any longer).
2007-12-14 20:14:44 +11:00
Neil Brown 3da92f272d Drop the superblock arg from all metadata methods.
It is now in the 'supertype'
2007-12-14 20:14:33 +11:00
Neil Brown 64557c3391 Fix compare_super to take supertype instead of a superblock.
As this function takes 2 superblocks, the change is a bit more subtle,
so is done separately.
2007-12-14 20:14:27 +11:00
Neil Brown 68c7d6d790 Add 'supertype' arg to almost all metadata methods.
The 'superblock' will be moved into this structure soon.
2007-12-14 20:14:16 +11:00
Neil Brown df37ffc039 Allow metadata handlers to free their own superblock.
As the metadata handler allocates the superblock, it should free it
too.  DDF will have a more complex 'superblock' which needs more complex
freeing.
2007-12-14 20:14:00 +11:00
Neil Brown aba69144fd Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Neil Brown 4855f95c70 Fix bug where v1 superblock might appear active when they should be clean.
Only happens on kernel with 32 bit sector_t.
2006-12-14 17:32:59 +11:00
Neil Brown beae1dfe2e Central calls to ioctl BLKGETSIZE
Instead of opencoding the same thing everywhere.
2006-12-14 17:32:57 +11:00
Neil Brown c5a6f9a61d Change handling for "--assemble --force" when two drives disappeared at once.
If two drives in a raid5 disappear at the same time, then "-Af"
will add them both in rather than just one and forcing the array
to 'clean'.  This is slightly safer in some cases.
2006-12-14 17:31:41 +11:00
Neil Brown bf4fb153a4 Fix and test --update=uuid
A number of odd bugs here, but now we have a regression test as well.
2006-12-14 17:31:29 +11:00
Neil Brown 583315d9c5 Give useful message if raid4/5/6 cannot be started because it is not clean and is also degraded. 2006-12-14 17:31:13 +11:00
Neil Brown 67a8c82d60 Make Assemble/Force work on raid6 with 2 missing devices.
Previously it onl worked when one missing device.
Also split the "force" update_super method into two and it
is really serving two functions.
2006-12-14 17:30:51 +11:00
Neil Brown 60e1bc1a33 Fixed problems that could cause infinitel loop with auto assemble.
If an auto-assembly attempt failes because the array cannot be
opened or because the array has already been created, then we
get into an infinite loop.

Reported-by: Dan Pascu <dan@ag-projects.com>
Fixes-debian-bug: 396582
2006-11-09 09:38:50 +11:00
Neil Brown 0430ed4868 Remove partitions from components of an md array
They do nothing but cause confusion.
2006-10-13 09:02:35 +10:00
Neil Brown d2df86e0a7 Improve the message when mdadm detects similar superblocks
If they are for a partition and a whole device (common case)
they old message doesn't really cover the situation.  So add
the "overlap" option to the text.
Also detect whether the device list was in mdadm.conf and
act accordingly.
2006-10-10 07:06:24 +10:00
Neil Brown 8aec876d2e More consistent honoring of --configfile
Never use /etc/mdadm.conf if --config file is given (previously
some code used one, some used the other).
2006-06-26 15:11:01 +10:00
Neil Brown 08110d41bc Fix a recently introduced bug, and make --assemble more resilient to it.
Make -assemble a bit more resilient to finding strange
 information in superblocks.
Don't claim newly added spares are InSync!! (don't know why that
 code was ever in there)
2006-06-26 12:26:12 +10:00
Neil Brown 6a255b69be Avoid misdetection of overlapping partitions...
As version-0.90 superblock don't record the superblock
offset, it is possible for overlapping partitions,
or a partition that starts on a 64K boundary in the whole device
to result in mis-detection - one partition or device might
be detected where the other was intended.

To avoid this awkward possibility, we reject assembly attempts
which seem to have two devices that are different but have the
same version-0.90 superblock.

To avoid this problem altogether, switch to version-1 metadata.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-06-02 06:58:39 +00:00
Neil Brown 9fca7d6236 check return status of all write/fwrite functions as required by glibc 2.4
From: Luca Berra <bluca@vodka.it>

glibc 2.4 is pedantic on ignoring return values from fprintf, fwrite and
write, so now we check the rval and actually do something with it.
in the Grow.c case i only print a warning, since i don't think we can do
anything in case we fail invalidating those superblocks (is should never
happen, but then...)

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-29 02:06:32 +00:00
Neil Brown 41a3b72a9c Release 2.5
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 07:12:48 +00:00
Neil Brown d1f1011b94 Make sure everything compiles...
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 04:28:33 +00:00
Neil Brown 589395d696 Support --auto-update-homehost
This can be used to bootstrape homehost tagging.

If no arrays are found that are tagged, we look for any array
and tag it.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 04:16:07 +00:00
Neil Brown d55e3aefc0 Support auto-assembling of stacked devices
and assorted bugfixes.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 03:11:57 +00:00
Neil Brown da6b5ca9bd Initial implementation of auto-assembly
This basically works, but needs various improvements and some tests.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 00:50:15 +00:00
Neil Brown 8a46fe8487 Allow autoassembly to choose it's own name for the array.
This cannot be used yet, but it is working towards auto-assembly.

When auto-assembling an array, we make a name in /dev/md/
giving a number (from the peferred minor) or name (from set-name).

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 06:46:40 +00:00
Neil Brown 83b6208e89 When assembly arrays using incomplete detail, prefer arrays built for this host.
i.e. if assembling with --name or --super-minor, then if we find two
different arrays with the same apparent identity, and one was built
for 'this' host, then prefer that one instead of giving up in disgust.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 06:33:28 +00:00
Neil Brown 811e6cbed7 Reorganise Assemble code somewhat.
We make sure all devices can are consistent before doing any --update
This saves us from updating some but not all of an array, and then
aborting.

It also means we can backtrack on out decisions, which we might want to
do later.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 06:12:40 +00:00
Neil Brown 624920bbb6 Make sure name matching for array assembly understand the possibility of a homehost
This "--assemble --name=foo" on host 'bar' will assemble an array named
'foo' or 'bar:foo'.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 05:24:22 +00:00
Neil Brown c4f12c1340 Allow --update=name to update the name during assembly.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 04:57:04 +00:00
Neil Brown e5eac01f3d Make sure homehost is set correctly when --update=uuid
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-23 04:51:39 +00:00
Neil Brown 4f589ad0c5 Just updaqte copyright dates and email address
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 05:25:11 +00:00
Neil Brown b8a8ccf945 New flag --no-degraded
Use to avoid starting arrays if there are
fewer devices available than last time the array was started.
This is only needed with --scan, as with --scan, that behaviour
is the default.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 04:53:22 +00:00
Neil Brown 8131b493df When updating uuid, update the bitmap as well - external bitmaps
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-16 06:05:27 +00:00
Neil Brown 7ef02d0143 Support 'bitmap=' in mdadm.conf for auto-assembling arrays with write-intent bitmaps in separate files.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-29 02:57:48 +00:00
Neil Brown 06b0d78675 Allow resize to backup to a file.
To support resizing an array without a spare, mdadm now understands
  --backup-file=
which should point to a file for storing a backup of critical data.
This can be given to --grow which will create the file, or
--assemble which will restore from the file if needed.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-27 06:38:46 +00:00
Neil Brown 313176636e Remove ident arg from getinfo_super;
Add a 'name' field to 'info' to compensate.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-27 04:34:38 +00:00
Neil Brown 39c5a90983 Release 2.4-pre1
Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-20 03:50:25 +00:00
Neil Brown 353632d927 Support restarting of a reshape on --assemble
Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-20 03:17:31 +00:00
Neil Brown 838acbc272 Assorted fixes...
Signed-off-by: Neil Brown <neilb@suse.de>
2006-01-27 01:44:47 +00:00
Neil Brown 7d99579f6a Support updating of uuid during --assemble.
Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:56:33 +00:00
Neil Brown ee04451c56 Allow event counters to be off by one
.. even without --force

Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:56:18 +00:00
Neil Brown c06487ce20 Improve option parsing
stuff

====Do Not Remove====
Status: ok
Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:54:33 +00:00
Neil Brown 8b0dabea07 Allow scanning of devices listed in /proc/partitions independant of /dev
If a device found in /proc/partitions isn't listed in /dev, then
mknod a temporary name and open that.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:52:50 +00:00
Neil Brown 308e1801ba Fix assembling of array with spares when verion-1 superblock is used.
As spared don't have a position in the raid array with verion-1 superblocks,
we need to handle them a bit differently.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-09-12 05:23:11 +00:00
Neil Brown 265e0f1731 Fix assembling of raid10 in the face of missing devices.
We now check if enough devices are present properly, so
--force can be used to good effect.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-09-12 04:57:52 +00:00
Neil Brown 6a41304b05 Fix but when assembling v1 arrays
Because raid_disk and disk.number are not longer in-sync,
it needed some work.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-15 06:35:38 +00:00
Neil Brown dab6685f3d Add 'quite' option and tidy up some tests.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-15 06:14:27 +00:00
Neil Brown 947fd4ddb5 Support nameing of version-1 arrays.
--name is recognised in --create and --assemble
name= is recognised in config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-09 05:23:20 +00:00
Neil Brown 586ed40547 Support fixing of byte-swapped superblocks.
Good for moving between little-endian and big-endian.
Still needs documentation.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-09 04:25:27 +00:00
Neil Brown f277ce3671 Assorted Fixes for multiple bugs.
Assemble would crash, or just not work.
A few other problem found by a new test-suite.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-04 04:41:12 +00:00
Neil Brown fbf8a0b7a6 Document this...
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-07-18 01:30:42 +00:00
Neil Brown 96395475fc Make --zero-superblock work for version 1 superblocks.
This requires passing the supertype to store_super

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:03:45 +00:00
Neil Brown 11484a635a Fix a test that will allow arrays with bitmaps to be assembled.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:03:47 +00:00
Neil Brown c82f047cfc Initial bitmap support
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-07 23:16:35 +00:00
Neil Brown 82d9eba687 super1
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Fix raid5 creation with new code.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:40 +00:00
Neil Brown f9ce90ba50 Add a 'super-switch' so that different format superblocks can be used.
This includes:
  adding --metadata= option to choose metadata format
  adding metadata= word to config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:32 +00:00
Neil Brown 4b1ac34b51 Separate sueprblock handling into separate file
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:18 +00:00
Neil Brown d7eaf49f65 Use O_EXCL when opening component devices to be assembled into an array
In 2.6, this will fail if the device is already in use, so we can detect this error
more easily.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 06:02:49 +00:00
Neil Brown 6f7e85bd16 Correct error message printed when the 'chosen_drive' cannot be added.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 05:16:26 +00:00
Neil Brown 0df46c2ad8 Change MAJOR() etc to major() etc
This allows for larger device number if glibc supports
it (requires 2.3.3).
Also fail before creating larger device number if glibc
support isn't present.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 05:16:13 +00:00
Neil Brown e5329c3747 mdadm-1.7.0 2004-08-11 02:16:01 +00:00
Neil Brown 98c6faba80 mdadm-1.5.0 2004-01-22 02:10:29 +00:00
Neil Brown feb716e9c3 mdadm-1.4.0 2003-10-28 23:20:01 +00:00
Neil Brown aa88f531b4 mdadm-1.3.0 2003-07-28 23:59:00 +00:00
Neil Brown 56eedc1a3f mdadm-1.2.0 2003-03-12 22:24:39 +00:00
Neil Brown d013a55e94 mdadm-1.1.0 2003-03-02 23:11:38 +00:00
Neil Brown 5787fa4906 mdadm-1.0.9 2003-02-12 00:17:26 +00:00
Neil Brown e0d1903663 mdadm-0.8 2002-04-04 01:58:32 +00:00
Neil Brown 11a3e71da4 mdadm-0.7.2 2002-03-20 22:39:50 +00:00
Neil Brown 9a9dab3670 mdadm-0.7 2002-03-08 00:03:52 +00:00
Neil Brown cd29a5c835 mdctl-0.6 2002-03-06 23:17:40 +00:00
Neil Brown 5282684628 mdctl-0.5 2001-08-23 02:33:20 +00:00
Neil Brown 0db17fcbde mdctl-v0.4.2 2001-07-26 20:47:22 +00:00
Neil Brown 82b27616de mdctl-v0.4 2001-07-26 07:00:09 +00:00