Commit Graph

352 Commits

Author SHA1 Message Date
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
Neil Brown 682c705194 mdctl-v0.3 2001-06-14 05:33:53 +00:00
Neil Brown 64c4757e27 mdctl-v0.2 2001-06-08 02:36:23 +00:00