]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
15 years agoCompile fixes, particularly moving more stuff under MDASSEMBLE
NeilBrown [Thu, 18 Sep 2008 05:04:47 +0000 (15:04 +1000)] 
Compile fixes, particularly moving more stuff under MDASSEMBLE

Now 'make everything' works again.

15 years agoDisable compilation with diet-libc
NeilBrown [Thu, 18 Sep 2008 04:33:37 +0000 (14:33 +1000)] 
Disable compilation with diet-libc

We need posix_memalign (or something similar) which diet-libc does not
provide.

15 years agoFix compile warning/error.
NeilBrown [Thu, 18 Sep 2008 04:10:42 +0000 (14:10 +1000)] 
Fix compile warning/error.

gcc said:
  error: large integer implicitly truncated to unsigned type

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdmon: recreate socket/pid file on SIGHUP
Dan Williams [Tue, 16 Sep 2008 03:58:43 +0000 (20:58 -0700)] 
mdmon: recreate socket/pid file on SIGHUP

Allow mdmon to start while /var/run/mdadm is readonly.  Later a SIGHUP
can trigger mdmon to drop its pid and socket once /var/run/mdadm is
writable.  Of course one needs the pid to send a HUP, that can be stored
in a distribution specific rw-init directory... For now, rely on a
killall -HUP mdmon to get the files dumped.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoping_manager() to prevent 'add' before 'remove' completes
Dan Williams [Tue, 16 Sep 2008 03:58:43 +0000 (20:58 -0700)] 
ping_manager() to prevent 'add' before 'remove' completes

It is currently possible to remove a device and re-add it without the
manager noticing, i.e. without detecting a mdstat->devcnt
container->devcnt mismatch.  Introduce ping_manager() to arrange for
mdmon to run manage_container() prior to mdadm dropping the exclusive
open() on the container.  Despite these precautions sysfs_read() may
still fail.  If this happens invalidate container->devcnt to ensure
manage_container() runs at the next event.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agosysfs: detect disks that are in the process of being removed
Dan Williams [Tue, 16 Sep 2008 03:58:43 +0000 (20:58 -0700)] 
sysfs: detect disks that are in the process of being removed

When removing a disk there is a window where the 'slot' attribute of
md/dev-$name will return -EBUSY to read attempts.  When this happens
look at the the 'block' link, if it is removed then we can be sure the
device has been removed, versus some other error.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomonitor: clean up some debug messages
Dan Williams [Tue, 16 Sep 2008 03:58:43 +0000 (20:58 -0700)] 
monitor: clean up some debug messages

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: resume rebuild
Dan Williams [Tue, 16 Sep 2008 03:58:43 +0000 (20:58 -0700)] 
mdmon: resume rebuild

If we started a degraded array that was previously rebuilding we may
have enough information to resume the rebuild without a trip through the
monitor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: allow a failed disk to be readded
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
imsm: allow a failed disk to be readded

Allow the following sequence to rebuild the array
mdadm --fail /dev/md/r1 /dev/disk
mdadm --remove /dev/imsm /dev/disk
mdadm --add /dev/imsm /dev/disk

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years ago'mdadm --wait-clean' wait for array to be marked clean
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
'mdadm --wait-clean' wait for array to be marked clean

For use in distro shutdown scripts with a RAID root file system.
Returns immediately if the array is 'readonly', or not an externally
managed array.  It is up to the distro's scripts to make sure no new
writes hit the device after this returns 'true'.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAdd ping_monitor() to mdadm --wait
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
Add ping_monitor() to mdadm --wait

The action we are waiting for may not be complete until the monitor has
had a chance to take action on the result.

The following script can now remove the device on the first attempt,
versus a few attempts with the original Wait():
#!/bin/bash
#export MDADM_NO_MDMON=1
export IMSM_DEVNAME_AS_SERIAL=1
./mdadm -Ss
./mdadm --zero-superblock /dev/loop[0-3]
echo 2 > /proc/sys/dev/raid/speed_limit_max
./mdadm --create /dev/imsm /dev/loop[0-3] -n 4 -e imsm -a md
./mdadm --create /dev/md/r1 /dev/loop[0-3] -n 4 -l 5 --force -a mdp
./mdadm --fail /dev/md/r1 /dev/loop3
./mdadm --wait /dev/md/r1
x=0
while  ! ./mdadm --remove /dev/imsm /dev/loop3 > /dev/null 2>&1
do
        x=$((x+1))
done
echo "removed after $x attempts"
./mdadm --add /dev/imsm /dev/loop3

Include 2 small cleanups:
* remove the almost open coded fd2devnum() in Wait() by introducing a
  new utility routine stat2devnum()
* teach connect_monitor() to parse the container device from a subarray
  string

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomonitor: don't mark dirty on resync complete
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
monitor: don't mark dirty on resync complete

...instead look at array state to determine if the array is consistent

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomonitor: mark clean on active-idle
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
monitor: mark clean on active-idle

This also handles the case where 'clean' is set directly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoHonor safemode_delay at Create() and Incremental() time
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
Honor safemode_delay at Create() and Incremental() time

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: use ->getinfo_super() in ->container_content()
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
imsm: use ->getinfo_super() in ->container_content()

* allows container_content() to pick up the safemode_delay
* removes some duplicate code
* fixes an endian bug setting info->array.chunk_size

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoAllow metadata handlers to communicate desired safemode delay via mdinfo
Dan Williams [Tue, 16 Sep 2008 03:58:42 +0000 (20:58 -0700)] 
Allow metadata handlers to communicate desired safemode delay via mdinfo

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoMakefile: Add mdmon header dependencies
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
Makefile: Add mdmon header dependencies

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix up serial handling
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: fix up serial handling

* Trim trailing and leading whitespace
* Allow unterminated serial numbers up to MAX_RAID_SERIAL_LEN

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: only use the device name as a fallback when IMSM_DEVNAME_AS_SERIAL=1
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: only use the device name as a fallback when IMSM_DEVNAME_AS_SERIAL=1

Also ensure that the serial buffer is initialized.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: rectify map handling
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: rectify map handling

The secondary map is used to reflect the migration state of the array
i.e.  from dev->vol.map[1] to dev->vol.map[0].  Ensure a rebuilding /
initializing array is marked in the second map, while normal status is
reflected in the first map.  Also mark rebuilding drives with
IMSM_ORD_REBUILD.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix imsm_delete()
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: fix imsm_delete()

* fix breakage from last merge (infinite loop in imsm_process_update())
* add ability to delete by index

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: use IMSM_ORD_REBUILD instead of USABLE flag
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: use IMSM_ORD_REBUILD instead of USABLE flag

IMSM_ORD_REBUILD is the 'insync' flag in MD terms.  USABLE is a flag to
opt-in disks for use with the Windows driver.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: introduce set_imsm_ord_tbl_ent()
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: introduce set_imsm_ord_tbl_ent()

Collapse all the open coded occurrences.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: cleanup arguments to imsm_check_degraded
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: cleanup arguments to imsm_check_degraded

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: cleanup get_imsm_disk_idx(), unify with get_imsm_ord_tbl_ent()
Dan Williams [Tue, 16 Sep 2008 03:58:41 +0000 (20:58 -0700)] 
imsm: cleanup get_imsm_disk_idx(), unify with get_imsm_ord_tbl_ent()

Save some unnecessary calls to get_imsm_map() by teaching
get_imsm_disk_idx() to retrieve the map.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix up compare_super_imsm() to match family_num for populated mpb's
Dan Williams [Tue, 16 Sep 2008 03:58:40 +0000 (20:58 -0700)] 
imsm: fix up compare_super_imsm() to match family_num for populated mpb's

This allows spares to be associated with any family while not allowing
disks from different families to be assembled.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix up spare handling holdover in update_create_array
Dan Williams [Tue, 16 Sep 2008 03:55:40 +0000 (20:55 -0700)] 
imsm: fix up spare handling holdover in update_create_array

We used to leave SPARE_DISK unset to indicate it was available to be
assimilated into other arrays.  Now we explicitly check the size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: mark failures like the Matrix driver
Dan Williams [Tue, 16 Sep 2008 03:55:34 +0000 (20:55 -0700)] 
imsm: mark failures like the Matrix driver

* Truncate the first character of the serial number
* Set 'scsi_id' to all f's
* Expect to find disk entries with unmatchable serial numbers, i.e.
  expect get_imsm_disk() to return NULL in some situations
* Allow discrepencies between mpb->num_disks and len(super->disks)

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: provide for a larger mpb buffer when necessary
Dan Williams [Tue, 16 Sep 2008 03:55:34 +0000 (20:55 -0700)] 
imsm: provide for a larger mpb buffer when necessary

Ensure that the mpb buffer is large enough to hold the extra imsm_map's
of migrating arrays and dynamically created raid devices.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix logic inversion in get_imsm_ord_tbl_ent()
Dan Williams [Tue, 16 Sep 2008 03:55:30 +0000 (20:55 -0700)] 
imsm: fix logic inversion in get_imsm_ord_tbl_ent()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoFix alignment for backup of reshape data.
NeilBrown [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
Fix alignment for backup of reshape data.

Since we introduced O_DIRECT for device access we need
properly aligned buffers and IO requests.  The reshape code
missed out on the conversion.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoAllow an externally managed array to be marked readonly
NeilBrown [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
Allow an externally managed array to be marked readonly

If the metadata_version is
    -mdXXX/whatever
rather than
    /mdXXX/whatever

then the array is readonly and should be left alone by mdmon.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFactor out test for subarray version string.
NeilBrown [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
Factor out test for subarray version string.

We are about to change the syntax of the version string
for 'subarray's.  So factor out the test into a single function.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoimsm: allow container assembly in the presence of failed disks
Dan Williams [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
imsm: allow container assembly in the presence of failed disks

For example, this allows one to still say mdadm -A /dev/sd[b-e] even
though /dev/sde has replaced /dev/sdd.  Otherwise mdadm will say:

mdadm: superblock on /dev/sdd doesn't match others - assembly aborted

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoFix bug with ddf if devices have different sizes.
NeilBrown [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
Fix bug with ddf if devices have different sizes.

We cannot use the header of the 'best' device to find the
sections on the other devices!!

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoProvide ddf support for adding a device to an active container.
NeilBrown [Tue, 19 Aug 2008 07:55:15 +0000 (17:55 +1000)] 
Provide ddf support for adding a device to an active container.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdadm: add device to a container
Dan Williams [Tue, 19 Aug 2008 07:19:51 +0000 (17:19 +1000)] 
mdadm: add device to a container

Adding a device updates the container and then mdmon takes action upon
noticing a change in devices.  This reuses the container version of
add_to_super to create a new record for the device.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdmon: remove devices from container
Dan Williams [Tue, 19 Aug 2008 04:55:12 +0000 (14:55 +1000)] 
mdmon: remove devices from container

Once the monitor thread has kicked a drive from all managed arrays mdadm
-r is permitted.  We are guaranteed that the drive is marked failed at
this point, so allow the drive to be re-added as a spare.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: delete kicked disks
Dan Williams [Tue, 19 Aug 2008 04:55:10 +0000 (14:55 +1000)] 
imsm: delete kicked disks

When we have determined that a disk is no longer of any value, remove
it from the data structure.   This is now safe because the manager
will back off while any metadata update is pending in the monitor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoFix mdstat_wait_fd
NeilBrown [Tue, 19 Aug 2008 04:55:07 +0000 (14:55 +1000)] 
Fix mdstat_wait_fd

It didn't necessarily wait for the fd.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoMake metadata updates from manage to monitor 'synchronous'
NeilBrown [Tue, 19 Aug 2008 04:55:03 +0000 (14:55 +1000)] 
Make metadata updates from manage to monitor 'synchronous'

A metadata update may modify the data structure of the metadata
including freeing things, so it is not safe of the manager to touch
the metadata while an update is pending in the monitor.
So When an update has been submitted, don't do anything else in the
manager until it is complete.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agoExtra option for set_array_state: you choose dirty or clean.
NeilBrown [Tue, 19 Aug 2008 04:54:55 +0000 (14:54 +1000)] 
Extra option for set_array_state: you choose dirty or clean.

When we first start an array, it might be good to start recovery
straight away.  That requires setting the array to 'dirty', but
only the metadata handler can know if that is required or not.
So have a third possible 'consistent' option to set_array_state.
Either 'no' or 'yes' or 'you choose'.

Return value indicates what was chosen.

'1' (no) should be chosen unless there is a good reason.

Signed-off-by: NeilBrown <neilb@suse.de>
15 years agomdmon: handle failures versus readauto arrays
Dan Williams [Wed, 30 Jul 2008 02:25:15 +0000 (19:25 -0700)] 
mdmon: handle failures versus readauto arrays

Transition readauto arrays to active before failing drives.

Hmm... why do we keep reblocking / renotifying in the readonly case?
Need to bottom out on this, but not right now.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: allow degraded arrays to be monitored
Dan Williams [Fri, 15 Aug 2008 17:58:43 +0000 (10:58 -0700)] 
mdmon: allow degraded arrays to be monitored

manage_new is too strict in the face of failed devices.  Teach it to
monitor degraded arrays.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: include not synced disks in imsm_count_failed
Dan Williams [Fri, 15 Aug 2008 17:58:42 +0000 (10:58 -0700)] 
imsm: include not synced disks in imsm_count_failed

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: use disk_ord_tbl to identify rebuilding disks
Dan Williams [Fri, 15 Aug 2008 17:57:19 +0000 (10:57 -0700)] 
imsm: use disk_ord_tbl to identify rebuilding disks

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix up assembly of disks that are not in-sync
Dan Williams [Tue, 12 Aug 2008 09:25:49 +0000 (02:25 -0700)] 
imsm: fix up assembly of disks that are not in-sync

1/ Do not assemble !in_sync or failed devices in container_content.
2/ Prevent activation of failed or configured devices in activate_spare.
3/ Be sure to avoid dirty degraded if the array was shutdown cleanly.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix create by mdmon-update
Dan Williams [Tue, 12 Aug 2008 09:25:49 +0000 (02:25 -0700)] 
imsm: fix create by mdmon-update

imsm_dev dynamically grows, so dev_idx needs to be moved up in the
definition to avoid getting clobbered.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: write_super return 0 on success
Dan Williams [Tue, 12 Aug 2008 09:25:49 +0000 (02:25 -0700)] 
imsm: write_super return 0 on success

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: update mpb_size in write_super_imsm
Dan Williams [Sun, 10 Aug 2008 03:28:24 +0000 (20:28 -0700)] 
imsm: update mpb_size in write_super_imsm

With dev->vol.map and mpb->disk entries entering and leaving the parameter
block write_super_imsm needs to update the size before writeback.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: use activate spare for re-add
Dan Williams [Tue, 12 Aug 2008 09:25:46 +0000 (02:25 -0700)] 
mdmon: use activate spare for re-add

Disks that are not in-sync or failed are not assembled into member
arrays by mdadm.  Teach mdmon to resolve this situation by checking for
spares at start.  imsm_activate_spare() is updated to prefer devices
that can be re-added versus new spares.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: fix handling of the 'migr_state' and 'migr_type' bits
Dan Williams [Sun, 10 Aug 2008 03:28:24 +0000 (20:28 -0700)] 
imsm: fix handling of the 'migr_state' and 'migr_type' bits

The option-rom and the Matrix driver mark resyncs/rebuilds with the
migrate state bits.  Update sizeof_imsm_dev to allow allocation of
imsm_dev entries large enough to grow if migr_state is later set.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: add get_imsm_map and sizeof_imsm_map
Dan Williams [Sun, 10 Aug 2008 03:28:24 +0000 (20:28 -0700)] 
imsm: add get_imsm_map and sizeof_imsm_map

retrieve map entries from a imsm_dev, and cleanup imsm_copy_dev

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: drop 'external' from imsm_examine_brief
Dan Williams [Sun, 10 Aug 2008 03:28:24 +0000 (20:28 -0700)] 
imsm: drop 'external' from imsm_examine_brief

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: ensure 'usable' remains clear until the disk is in_sync
Dan Williams [Sun, 10 Aug 2008 03:28:24 +0000 (20:28 -0700)] 
imsm: ensure 'usable' remains clear until the disk is in_sync

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: spare devices are represented as single disk containers
Dan Williams [Wed, 6 Aug 2008 16:09:25 +0000 (09:09 -0700)] 
imsm: spare devices are represented as single disk containers

This poses a small problem for the case of handling multiple raid1 arrays
across separate disk pairs i.e. 2 mirrors on 4 disks.  The option-ROM will
configure this as two containers.  We may need the capability for one
container to ask for an unused spare in another container.  For now spares
will just maintain the affinity established at assemble time.

To support this configuration spare devices must be allowed to be assembled
into the container even though the metadata indicates the disk belongs to a
different family.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: store imsm_disk entries in the super->disks list
Dan Williams [Fri, 8 Aug 2008 06:57:50 +0000 (23:57 -0700)] 
imsm: store imsm_disk entries in the super->disks list

removes the need to lookup the disk by index in a few cases and is a
preparation step for tracking spares outside the current anchor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: use 'recover' instead of 'repair' when activating a spare
Dan Williams [Thu, 7 Aug 2008 18:54:09 +0000 (11:54 -0700)] 
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>
15 years agoMerge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm...
NeilBrown [Thu, 7 Aug 2008 07:46:44 +0000 (17:46 +1000)] 
Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/mdadm into dan

15 years agoimsm: bad block management (phase1)
Jacek Danecki [Thu, 7 Aug 2008 06:55:53 +0000 (23:55 -0700)] 
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>
15 years agoimsm: do not mark arrays 'clean' if resync still in progress
Dan Williams [Thu, 7 Aug 2008 06:53:44 +0000 (23:53 -0700)] 
imsm: do not mark arrays 'clean' if resync still in progress

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: raid5 layout is left-asymmetric
Dan Williams [Thu, 7 Aug 2008 06:53:44 +0000 (23:53 -0700)] 
imsm: raid5 layout is left-asymmetric

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoMerge branch 'master' into from-stable
NeilBrown [Thu, 7 Aug 2008 04:12:25 +0000 (14:12 +1000)] 
Merge branch 'master' into from-stable

Conflicts:

Create.c
Manage.c

15 years agomdmon: ignore inactive arrays and other manage_new() cleanups
Dan Williams [Wed, 30 Jul 2008 02:01:06 +0000 (19:01 -0700)] 
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>
15 years agoCosmetic cleanup of some messages.
NeilBrown [Fri, 1 Aug 2008 06:48:08 +0000 (16:48 +1000)] 
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>
15 years agoimsm: trim some memory wastage
Dan Williams [Sat, 26 Jul 2008 00:45:13 +0000 (17:45 -0700)] 
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>
15 years agoimsm: refactor mpb handling into parse and coalesce
Dan Williams [Fri, 25 Jul 2008 23:59:47 +0000 (16:59 -0700)] 
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>
15 years agomdmon: don't fork if DEBUG
Dan Williams [Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)] 
mdmon: don't fork if DEBUG

15 years agoimsm: use component_size not total array size in container_content_imsm
Dan Williams [Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)] 
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>
15 years agoimsm: take chunksize into account when calculating blocks_per_member
Dan Williams [Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)] 
imsm: take chunksize into account when calculating blocks_per_member

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agosysfs: deprecate sysfs_disk_to_sg
Dan Williams [Fri, 25 Jul 2008 00:26:24 +0000 (17:26 -0700)] 
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>
15 years agoimsm: fix store_zero_imsm breakage from posix_memalign conversion
Dan Williams [Fri, 25 Jul 2008 00:26:23 +0000 (17:26 -0700)] 
imsm: fix store_zero_imsm breakage from posix_memalign conversion

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: debug environment variable to use 'device name' as 'serial number'
Dan Williams [Fri, 25 Jul 2008 00:26:23 +0000 (17:26 -0700)] 
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>
15 years agoimsm: allow --examine to succeed with damaged metadata
Dan Williams [Fri, 25 Jul 2008 00:26:23 +0000 (17:26 -0700)] 
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>
15 years agoimsm: handle degraded->normal transitions in set_disk
Dan Williams [Fri, 25 Jul 2008 00:26:23 +0000 (17:26 -0700)] 
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>
15 years agoimsm: create array via update to mdmon
Dan Williams [Fri, 25 Jul 2008 00:26:19 +0000 (17:26 -0700)] 
imsm: create array via update to mdmon

15 years agoClean up usage of open()
Doug Ledford [Thu, 24 Jul 2008 22:35:11 +0000 (18:35 -0400)] 
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>
15 years agoAdd support for distribution specific build extensions
Doug Ledford [Thu, 24 Jul 2008 16:34:34 +0000 (12:34 -0400)] 
Add support for distribution specific build extensions

Signed-off-by: Doug Ledford <dledford@redhat.com>
15 years agoinstall mdmon to the same location as mdadm
Jacek Danecki [Tue, 22 Jul 2008 00:42:12 +0000 (17:42 -0700)] 
install mdmon to the same location as mdadm

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: remove some casts
Dan Williams [Tue, 22 Jul 2008 00:42:10 +0000 (17:42 -0700)] 
imsm: remove some casts

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoimsm: activate_spare: fix handling of data_offset
Dan Williams [Mon, 21 Jul 2008 18:08:20 +0000 (11:08 -0700)] 
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>
15 years agoDocument MDADM_NO_MDMON
Dan Williams [Sat, 19 Jul 2008 00:47:34 +0000 (17:47 -0700)] 
Document MDADM_NO_MDMON

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoDocumentation fixup for stripe_cache_size
Dan Williams [Sat, 19 Jul 2008 00:47:13 +0000 (17:47 -0700)] 
Documentation fixup for stripe_cache_size

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agoDocument preread_bypass_threshold
Dan Williams [Sat, 19 Jul 2008 00:14:44 +0000 (17:14 -0700)] 
Document preread_bypass_threshold

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomsg: add a timeout to ping_monitor
NeilBrown [Fri, 18 Jul 2008 06:37:28 +0000 (16:37 +1000)] 
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>
15 years agomonitor: call get_resync_start on array shutdown.
NeilBrown [Fri, 18 Jul 2008 06:37:26 +0000 (16:37 +1000)] 
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>
15 years agoManage: sync with mdmon before stopping containers.
NeilBrown [Fri, 18 Jul 2008 06:37:25 +0000 (16:37 +1000)] 
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>
15 years agoManage: fixed some error message in --stop
NeilBrown [Fri, 18 Jul 2008 06:37:24 +0000 (16:37 +1000)] 
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>
15 years agomdmon: fork and run as a daemon.
NeilBrown [Fri, 18 Jul 2008 06:37:20 +0000 (16:37 +1000)] 
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>
15 years agosysfs: avoid possible data corruption in sys_load.
NeilBrown [Fri, 18 Jul 2008 06:37:18 +0000 (16:37 +1000)] 
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>
15 years agoCorrect readlink usage in sysfs.c
NeilBrown [Fri, 18 Jul 2008 06:37:16 +0000 (16:37 +1000)] 
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>
15 years agoDon't assume that mdmon is in the current directory.
NeilBrown [Fri, 18 Jul 2008 06:37:13 +0000 (16:37 +1000)] 
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>
15 years agoFactor common code into new "start_mdmon".
NeilBrown [Fri, 18 Jul 2008 06:37:11 +0000 (16:37 +1000)] 
Factor common code into new "start_mdmon".

Signed-off-by: Neil Brown <neilb@suse.de>
15 years agoStop managed arrays more carefully.
Neil Brown [Fri, 18 Jul 2008 06:37:09 +0000 (16:37 +1000)] 
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>
15 years agomdmon: ping will wait for manage_mon to catch up.
NeilBrown [Fri, 18 Jul 2008 06:37:06 +0000 (16:37 +1000)] 
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>
15 years agoMake sure resync_start is initialised properly and maintained properly
Neil Brown [Fri, 18 Jul 2008 06:37:04 +0000 (16:37 +1000)] 
Make sure resync_start is initialised properly and maintained properly

Signed-off-by: Neil Brown <neilb@suse.de>
15 years agoddf: endian fixes.
Neil Brown [Fri, 18 Jul 2008 06:37:03 +0000 (16:37 +1000)] 
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>
15 years agomdmon: close possibility of re-marking the metadata dirty on shutdown
Dan Williams [Mon, 14 Jul 2008 21:59:39 +0000 (14:59 -0700)] 
mdmon: close possibility of re-marking the metadata dirty on shutdown

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: notify metadata of recovery completion
Dan Williams [Mon, 14 Jul 2008 21:59:39 +0000 (14:59 -0700)] 
mdmon: notify metadata of recovery completion

Array may no longer be degraded.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
15 years agomdmon: initialize component_size in manage_new
Dan Williams [Mon, 14 Jul 2008 21:59:39 +0000 (14:59 -0700)] 
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>