]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
monitor: protect against CONFIG_LBD=n
authorDan Williams <dan.j.williams@intel.com>
Sun, 28 Sep 2008 19:12:06 +0000 (12:12 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 15 Oct 2008 21:15:51 +0000 (14:15 -0700)
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>
mdmon.h
super-ddf.c
super-intel.c

diff --git a/mdmon.h b/mdmon.h
index 62f34f7eae2b9706e20ddbcdd5aefaaea626871a..41222e1c5a0aa60e502ebf65c8afc9819c899e8a 100644 (file)
--- a/mdmon.h
+++ b/mdmon.h
@@ -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;
+}
+
index ad21e74a3c82fee0ded5074d1b737ac921b330db..e8f80051042a52dfebcf9006334dd03f718ac354 100644 (file)
@@ -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;
index 87cef13a314c3d9cb3d254dbd648258301ef5328..7e1f986ba7d3026ca6aae4baaea471b42e4e7715 100644 (file)
@@ -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
                 */