Commit Graph

611 Commits

Author SHA1 Message Date
Dan Williams f54e6321a2 imsm: use component_size not total array size in container_content_imsm
Also kill setting ->array.size as nothing appears to be using it.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:24 -07:00
Dan Williams fcfd95998b imsm: take chunksize into account when calculating blocks_per_member
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:24 -07:00
Dan Williams 755c99faf2 sysfs: deprecate sysfs_disk_to_sg
The cmd_filter patch merged for 2.6.27 broke retrieving the serial
number via an ioctl to /dev/sgN.  In debugging this I found that other
utilities like sdparm simply run the ioctl on /dev/sdX.  So just convert
to that for protection in numbers, but scream on the mailing list for
the inconvenience grr...

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:24 -07:00
Dan Williams eb7ea4630f imsm: fix store_zero_imsm breakage from posix_memalign conversion
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:23 -07:00
Dan Williams 0030e8d690 imsm: debug environment variable to use 'device name' as 'serial number'
Facilitate using loopback devices for the imsm regression suite

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:23 -07:00
Dan Williams e9d82038f8 imsm: allow --examine to succeed with damaged metadata
limp along after seeing mismatched serial numbers

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:23 -07:00
Dan Williams 5802a8118e imsm: handle degraded->normal transitions in set_disk
Removes the need for the call to ->set_array_state when sync_action
transitions from 'recover' to 'idle'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-24 17:26:23 -07:00
Dan Williams 8273f55e4f imsm: create array via update to mdmon 2008-07-24 17:26:19 -07:00
Jacek Danecki 4ad866b132 install mdmon to the same location as mdadm
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-21 17:42:12 -07:00
Dan Williams ef649044b7 imsm: remove some casts
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-21 17:42:10 -07:00
Dan Williams 5257ce365b imsm: activate_spare: fix handling of data_offset
Neil rightly points out that imsm_activate_spare may skip valid free space
on a spare, fix this up.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-21 11:08:20 -07:00
Dan Williams 5545fa6d94 Document MDADM_NO_MDMON
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-18 17:47:34 -07:00
Dan Williams 800053d600 Documentation fixup for stripe_cache_size
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-18 17:47:13 -07:00
Dan Williams a5ee6dfbf5 Document preread_bypass_threshold
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-18 17:14:44 -07:00
NeilBrown eb2c876f4d msg: add a timeout to ping_monitor
Though it should never bee needed, having a timeout in ping_monitor is
a sensible safeguard.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:28 +10:00
NeilBrown 33af8567de monitor: call get_resync_start on array shutdown.
If the array is shutdown as soon as resync finishes, we might not
notice the resync finish.  So on array shutdown, check for current
resync pos.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:26 +10:00
NeilBrown ada6c2390a Manage: sync with mdmon before stopping containers.
mdmon sometimes opens the container.  That will prevent 'stop'
from working.  So sync with mdmon first.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:25 +10:00
NeilBrown 4b9d39fc17 Manage: fixed some error message in --stop
Explain the meaning of 'quiet' explicitly, and fix some grammar
and formatting.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:24 +10:00
NeilBrown 9fe3204317 mdmon: fork and run as a daemon.
start_mdmon now waits for mdmon to complete initialisation and,
importantly, listen on the socket, before continuing.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:20 +10:00
NeilBrown 8dfb8619f9 sysfs: avoid possible data corruption in sys_load.
Don't retry to remove a newline from the end of an empty string.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:18 +10:00
NeilBrown 7364918895 Correct readlink usage in sysfs.c
readlink doesn't nul-terminate the returned string, so we must
be sure to do that.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:16 +10:00
NeilBrown 44d2e36556 Don't assume that mdmon is in the current directory.
Rather, assume that it is in the same directory from which
mdadm was run.  If not, then maybe /sbin or current directory.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:13 +10:00
NeilBrown 8850ee3e1e Factor common code into new "start_mdmon".
Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:11 +10:00
Neil Brown daf7a3ce96 Stop managed arrays more carefully.
If an array is being managed by mdmon, then just
write "inactive" to stop it, and let mdmon do the
final "clear".  This makes sure mdmon has a chance
to read the final state and update the metadata properly.

After writing "inactive" with use "ping_monitor" to synchronise
with mdadm, then STOP the array just in case it is still running,
else we will get into an infinite loop in "mdadm -Ss".

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:09 +10:00
NeilBrown 1eb252b848 mdmon: ping will wait for manage_mon to catch up.
When a 'ping' (empty message) is sent to mdmon, we wait for
'monitor' to do a full loop to make sure it has caught up
with anything that needs doing.
This allows synchronisation between mdadm and mdmon.

Maybe monitor should signal managemon rather than managemon polling...

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:06 +10:00
Neil Brown 103f2410ec Make sure resync_start is initialised properly and maintained properly
Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:04 +10:00
Neil Brown 120f767760 ddf: endian fixes.
We forgot to convert endian for lba_offset at one point,
and use le32 instead of be32 right nearby!!

Signed-off-by: Neil Brown <neilb@suse.de>
2008-07-18 16:37:03 +10:00
Dan Williams 00e021427e mdmon: close possibility of re-marking the metadata dirty on shutdown
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
Dan Williams 0a6bdbee8d mdmon: notify metadata of recovery completion
Array may no longer be degraded.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
Dan Williams 272bcc48d1 mdmon: initialize component_size in manage_new
When we go to activate a spare for an array we expect ->info.component_size
is valid.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-14 14:59:39 -07:00
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