Commit Graph

581 Commits

Author SHA1 Message Date
Dan Williams 2cc98f9ea5 mdmon: close small window of invalid mon_tid
There is a small chance that the manager tries to wake the monitor before
mon_tid is set.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
Dan Williams 5dcfcb715d mdadm: add an environment variable to prevent auto-launching mdmon
Useful for attaching gdb to mdmon before any action is taken on the array.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:32 -07:00
Dan Williams 00451d9874 managemon: don't treat sysfs_add_disk as boolean function
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:10:02 -07:00
Dan Williams e8319a19f2 imsm: process update
Handle 'activate_spare' events
2008-07-14 14:10:02 -07:00
Dan Williams 88758e9daa imsm: activate_spare
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:09:48 -07:00
Dan Williams 2da8544a39 imsm: metadata only supports a global 'data_offset'
When creating a volume a drive must have free space starting at the same
location as all the other drives in the array.
2008-07-14 13:59:56 -07:00
Dan Williams ef6ffaded4 imsm: fix raid1 creation
Need to supply dummy values for the chunk size and number of data stripes

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:58:19 -07:00
Dan Williams 0372d5a2f4 imsm: fail ->open_new if container_member is out of range
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:57:33 -07:00
Dan Williams a3d6757fbf imsm: kill obsolete call to fsync() in store_imsm_mpb
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:56:42 -07:00
Dan Williams 2c092cada6 imsm: fix insufficient mpb buffer allocation
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:56:28 -07:00
Dan Williams ad97895ec8 imsm: catch posix_memalign allocation failures
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:55:12 -07:00
Dan Williams bf5a934aff imsm: remove extra superswitches
Following the lead of 75ede16d.  This incidentally fixes creation of a second
array by gating call to getinfo_super_imsm_volume with a valid ->current_vol.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:55:12 -07:00
Dan Williams 99e2926423 imsm: fix store_imsm_mpb() alignment for O_DIRECT
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 13:55:02 -07:00
Neil Brown f7f1b6a1db Print used message in place of "default metadata" message.
When creating an array in a container, print e.g.
   Creating array inside ddf container /dev/whatever
rather than
   Defaulting to version /md127/1 metadata
2008-07-12 20:28:38 +10:00
Neil Brown 77472ff8d0 Introduce devname2devnum
and use it instead of opencoding.
2008-07-12 20:28:38 +10:00
Neil Brown d7161f3b51 Fix fd comparison in Incremental
fd==0 is theoretically possible...
2008-07-12 20:28:38 +10:00
Neil Brown 2c514b7120 Pass 'verbose' flag to validate_geometry
That way it can be silent when we are just trying to figure out
which metadata to use, and noisy when detecting a real problem.
2008-07-12 20:28:38 +10:00
Neil Brown 047d2e49f5 Correct unit conversion for component_size and dev/size in sysfs.
These are both Kilobytes, so do the conversion to sectors properly.
2008-07-12 20:28:38 +10:00
Neil Brown 6416d5275d Use O_DIRECT for all IO to devices.
Using buffered IO risks non-atomic updates to parts of the
device that we don't actually want to write to.  This isn't in
general safe.
So switch to O_DIRECT for all that IO and make sure we have
properly aligned buffers.
2008-07-12 20:28:33 +10:00
Neil Brown 908ef18519 Stop all arrays before running each test in regression test driver.
Sometimes I forget to stop arrays at the end of scripts, and
that shows errors in the next script, which is confusing.
2008-07-12 20:27:42 +10:00
Neil Brown 3576e302fe ddf: Set container_member from subarray in getinfo_super.
Also go direct from subarray to text_version.
2008-07-12 20:27:42 +10:00
Neil Brown 18a2f463fd Reduce the number of metadata updates done by ddf.
1/ track if there are any actual updates pending, and only
   write metadata when we have changed something.

2/ when writing null virtual-configs, write full blocks,
   not just the first 4 bytes.  This will allow O_DIRECT
   writes in a subsequent patch.
2008-07-12 20:27:42 +10:00
Neil Brown 48561b0142 Improve shutdown for container-based arrays.
1/ close a race where multiple arrays disappear at once
   and monitor isn't woken up to find out that the last one
   has gone.
2/ "mdadm -Ss" needs to pause briefly for mdmon to exit.
2008-07-12 20:27:42 +10:00
Neil Brown c7c149300b Keep container device open in monitor
... so that it cannot be stopped while there are active arrays.
I don't know where that second 'close' came from ....
2008-07-12 20:27:42 +10:00
Neil Brown 207aac36d5 Make sure we remove pid file in monitor before manager exits. 2008-07-12 20:27:42 +10:00
Neil Brown a35c070bcd Remove some noisy printfs. 2008-07-12 20:27:41 +10:00
Neil Brown edd8d13c02 Create arrays via metadata-update
Support creating arrays inside an active ddf container by
sending a metadata update over a pipe to mdmon.
2008-07-12 20:27:40 +10:00
Neil Brown bfa44e2e7a Revise message passing code.
More here
2008-07-12 20:27:40 +10:00
Neil Brown 4d43913ce0 Remove mgr_pipe for communicating from manage to monitor.
Data is being passed in shared memory, so the pipe is only being
use as a wakeup.  This can more easily be done with a thread-signal.
2008-07-12 20:27:40 +10:00
Neil Brown 2f64e61a50 Remove mon_pipe for communicating from monitor to manager
The returned value was never used, and we don't really want
this return path anyway as writing to a pipe could conceivably
block, and the monitor must not block.
2008-07-12 20:27:40 +10:00
Neil Brown f94d52f43e Handle device removal from container
This really should be done in mdadm, not mdmon.
We ensure the device won't be suddenly commited as a hot-spare
using O_EXCL, then check the 'holders' sysfs directory
to make sure it is only in use once.
2008-07-12 20:27:40 +10:00
Neil Brown d4da74fc9c Fix kernel patch 2008-07-12 20:27:39 +10:00
Neil Brown ec9688ca70 Make super super0.c function static.
So only 'super0' is externally visible.
2008-07-12 20:27:39 +10:00
Neil Brown 78e449282e Remove the multiple super_switchs for ddf.
It is simpler if there is just one, and the methods
make decisions as appropriate.
2008-07-12 20:27:39 +10:00
Neil Brown ba7eb04f71 Remove silly convention that major='-1' means 'zero superblock'.
Use 'info pointer is NULL' instead.
2008-07-12 20:27:39 +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 0d481d3723 External metadata shouldn't set array.*_version
It doesn't mean anything and is never used.
2008-07-12 20:27:39 +10:00
Neil Brown f7e7067b47 Add subarray field to supertype.
When loading the metadata for a subarray (super_by_fd), we set
->subarray to be the name read from md/metadata_version so that
getinfo_super can return info about the correct array.

With this we can differentiate between a container and
an array within the container by looking at ->subarray[0].
2008-07-12 20:27:38 +10:00
Neil Brown 6adfd3affd Add some comments to explain some of the bits of superswitch. 2008-07-12 20:27:38 +10:00
Neil Brown 0063ecba3d Hide subordinate superswitch structures.
Only one superswitch should be externally visible for each
general type.  Others which handle different flavours
(e.g. container/data-array) should be internal only.
2008-07-12 20:27:38 +10:00
Neil Brown b8ac196795 Remove 'major' from superswitch.
It isn't generally meaningful.
2008-07-12 20:27:37 +10:00
Neil Brown 1522c538b1 Use text_version in map_file rather than major.minor. 2008-07-12 20:27:37 +10:00
Neil Brown 59e3626815 Assorted cleanups to DDF 2008-07-12 20:27:37 +10:00
Neil Brown a0c8a17f66 Fix write_init_super usage when hot-adding a spare
Using write_init_super to add a spare to an active array is quite
different to how it is used when creating an array.

It mostly works, but if we are adding two devices to an array,
then when we add the second, there are still traces of the first
which confuse write_init_super.

So get write_init_super to ignore those traces.  Longer term, we
probably want to do this differently as for DDF, hot-adding to
an active array will have to be quite different - it will want to
write to all metadata, possibly via mdmon.
2008-07-12 20:27:36 +10:00
Neil Brown 6264b43733 Always zero a struct ddf_super on allocation. 2008-07-12 20:27:36 +10:00
Neil Brown ef60947720 Always initialise a struct super_type to zero 2008-07-12 20:27:36 +10:00
Neil Brown 904c1ef77b Fix freeing of updates that have been handled by monitor.
Yes, we do want to free the buf, and the space too if it is still
there.
2008-07-12 20:27:33 +10:00
Neil Brown d024b0a7eb Always assume_clean for raid0, linear, multipath, faulty
For arrays that don't have redundancy (raid0, linear etc), the
clean/dirty distinction doesn't mean anything.  So always
'assume clean' for these arrays.
2008-07-11 08:50:06 +10:00
Neil Brown 9686a7b5c5 Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-06-20 15:13:27 +10:00
Neil Brown b57f7529f8 Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into devel-3.0 2008-06-19 16:41:25 +10:00