Commit Graph

633 Commits

Author SHA1 Message Date
Dan Williams 63d7cc784b mdmon: use 'recover' instead of 'repair' when activating a spare
Repair sets MD_RECOVERY_REQUESTED in md which may not result in the
spare device being recovered.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-07 11:54:09 -07:00
NeilBrown 3dff19c8e8 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into dan 2008-08-07 17:46:44 +10:00
Jacek Danecki 604b746f7c imsm: bad block management (phase1)
This is the initial defensive implementation of bad block management
support.  It simply precludes assembly if there are entries in the bad
block logs.  This is sufficient for now as the conditions that lead to
an entry in the bad block log would cause the array to be failed by MD
(as of 2.6.27).

[dan.j.williams@intel.com: general cleanups]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-06 23:55:53 -07:00
Dan Williams 115c380305 imsm: do not mark arrays 'clean' if resync still in progress
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-06 23:53:44 -07:00
Dan Williams a380c027e3 imsm: raid5 layout is left-asymmetric
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-06 23:53:44 -07:00
NeilBrown 37ea3936a6 Merge branch 'master' into from-stable
Conflicts:

	Create.c
	Manage.c
2008-08-07 14:12:25 +10:00
Dan Williams 836759d561 mdmon: ignore inactive arrays and other manage_new() cleanups
While mdadm is constructing an array mdmon may see an intermediate state
(some disks not yet added / redundancy attributes like sync_action not
available).  Waiting for mdstat->active == true ensures that the array
is ready to be handled.  This fixes a bug in create array via mdmon
update whereby failures are not detected in the new array.

Introduce aa_ready() to catch cases where the active_array is not
correctly initialized.  Barring a kernel bug this should never trigger,
nonetheless it precludes a class of bugs like the one mentioned above
from triggering.

Cleanup the exit paths and only call replace_array when the new array is
ready to be inserted into container->arrays.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-08-04 16:48:27 -07:00
NeilBrown e5669f4004 Cosmetic cleanup of some messages.
e.g. --raid-disks is preferred over --raid-devices.

 Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net>

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-01 16:48:08 +10:00
Dan Williams 9ca2c81c0f imsm: trim some memory wastage
drop the previously loaded data as load_imsm_super_all loops through the
disks.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-25 17:45:13 -07:00
Dan Williams 949c47a0fa imsm: refactor mpb handling into parse and coalesce
Maintaining a single global buffer is unwieldly when extending/rewriting
sections of the metadata.  Parse the metadata into component data
structures upon reading and coalesce to a coherent buffer before
writing.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-07-25 16:59:47 -07:00
Dan Williams 16ddab0daf mdmon: don't fork if DEBUG 2008-07-24 17:26:24 -07:00
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
Doug Ledford fb97b4d691 Clean up usage of open()
Fix on call that passed an invalid mode to open
	Don't pass a third arg unless we also pass O_CREAT
	Use symbolic args for 2nd and 3rd args

Signed-off-by: Doug Ledford <dledford@redhat.com>
2008-07-24 18:35:11 -04:00
Doug Ledford 0bc38b5020 Add support for distribution specific build extensions
Signed-off-by: Doug Ledford <dledford@redhat.com>
2008-07-24 12:34:34 -04: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