diff options
author | Dan Williams <dan.j.williams@intel.com> | 2008-09-28 12:12:06 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-10-15 14:15:51 -0700 |
commit | 593add1b56877a6881419c2496eb26dd1f82d39b (patch) | |
tree | 104f8a56227c11845036fe9b9f782e4eb21395f1 | |
parent | 14e8215b1b996813e467ae6fba71b0e4f5690103 (diff) | |
download | mdadm-593add1b56877a6881419c2496eb26dd1f82d39b.tar.gz mdadm-593add1b56877a6881419c2496eb26dd1f82d39b.tar.xz mdadm-593add1b56877a6881419c2496eb26dd1f82d39b.zip |
monitor: protect against CONFIG_LBD=n
md/resync_start reports different terminal values depending on kernel
configuration (~0UL versus ~0ULL). Make detection of the
resync-complete state more robust by comparing against array size.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | mdmon.h | 11 | ||||
-rw-r--r-- | super-ddf.c | 4 | ||||
-rw-r--r-- | super-intel.c | 4 |
3 files changed, 15 insertions, 4 deletions
@@ -59,3 +59,14 @@ struct mdstat_ent *mdstat_read(int hold, int start); extern int exit_now, manager_ready; extern int mon_tid, mgr_tid; extern int monitor_loop_cnt; + +/* helper routine to determine resync completion since MaxSector is a + * moving target + */ +static inline int is_resync_complete(struct active_array *a) +{ + if (a->resync_start >= a->info.component_size) + return 1; + return 0; +} + diff --git a/super-ddf.c b/super-ddf.c index ad21e74..e8f8005 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -2748,7 +2748,7 @@ static int ddf_set_array_state(struct active_array *a, int consistent) if (consistent == 2) { /* Should check if a recovery should be started FIXME */ consistent = 1; - if (a->resync_start != ~0ULL) + if (!is_resync_complete(a)) consistent = 0; } if (consistent) @@ -2760,7 +2760,7 @@ static int ddf_set_array_state(struct active_array *a, int consistent) old = ddf->virt->entries[inst].init_state; ddf->virt->entries[inst].init_state &= ~DDF_initstate_mask; - if (a->resync_start == ~0ULL) + if (is_resync_complete(a)) ddf->virt->entries[inst].init_state |= DDF_init_full; else if (a->resync_start == 0) ddf->virt->entries[inst].init_state |= DDF_init_not; diff --git a/super-intel.c b/super-intel.c index 87cef13..7e1f986 100644 --- a/super-intel.c +++ b/super-intel.c @@ -2474,12 +2474,12 @@ static int imsm_set_array_state(struct active_array *a, int consistent) __u8 map_state = imsm_check_degraded(super, dev, failed); if (consistent == 2 && - (a->resync_start != ~0ULL || + (!is_resync_complete(a) || map_state != IMSM_T_STATE_NORMAL || dev->vol.migr_state)) consistent = 0; - if (a->resync_start == ~0ULL) { + if (is_resync_complete(a)) { /* complete intialization / resync, * recovery is completed in ->set_disk */ |