Whamcloud - gitweb
LU-7931 tests: Allow per-subtest setup/cleanup
[fs/lustre-release.git] / lustre / lfsck / lfsck_engine.c
index 6daaf80..56052c2 100644 (file)
@@ -1006,6 +1006,18 @@ int lfsck_master_engine(void *args)
        int                       rc;
        ENTRY;
 
+       /* There will be some objects verification during the LFSCK start,
+        * such as the subsequent lfsck_verify_lpf(). Trigger low layer OI
+        * OI scrub before that to handle the potential inconsistence. */
+       oit_di = oit_iops->init(env, oit_obj, lfsck->li_args_oit);
+       if (IS_ERR(oit_di)) {
+               rc = PTR_ERR(oit_di);
+               CDEBUG(D_LFSCK, "%s: master engine fail to init iteration: "
+                      "rc = %d\n", lfsck_lfsck2name(lfsck), rc);
+
+               GOTO(fini_args, rc);
+       }
+
        if (lfsck->li_master &&
            (!list_empty(&lfsck->li_list_scan) ||
             !list_empty(&lfsck->li_list_double_scan))) {
@@ -1021,15 +1033,6 @@ int lfsck_master_engine(void *args)
                               lfsck_lfsck2name(lfsck), rc);
        }
 
-       oit_di = oit_iops->init(env, oit_obj, lfsck->li_args_oit);
-       if (IS_ERR(oit_di)) {
-               rc = PTR_ERR(oit_di);
-               CDEBUG(D_LFSCK, "%s: master engine fail to init iteration: "
-                      "rc = %d\n", lfsck_lfsck2name(lfsck), rc);
-
-               GOTO(fini_args, rc);
-       }
-
        spin_lock(&lfsck->li_lock);
        lfsck->li_di_oit = oit_di;
        spin_unlock(&lfsck->li_lock);
@@ -1149,9 +1152,10 @@ static int lfsck_assistant_query_others(const struct lu_env *env,
        memset(lr, 0, sizeof(*lr));
        lr->lr_event = LE_QUERY;
        lr->lr_active = com->lc_type;
+
+       memset(laia, 0, sizeof(*laia));
        laia->laia_com = com;
        laia->laia_lr = lr;
-       laia->laia_shared = 0;
 
        if (!list_empty(&lad->lad_mdt_phase1_list)) {
                ltds = &lfsck->li_mdt_descs;
@@ -1265,9 +1269,10 @@ static int lfsck_assistant_notify_others(const struct lu_env *env,
 
        lr->lr_index = lfsck_dev_idx(lfsck);
        lr->lr_active = com->lc_type;
+
+       memset(laia, 0, sizeof(*laia));
        laia->laia_com = com;
        laia->laia_lr = lr;
-       laia->laia_shared = 0;
 
        switch (lr->lr_event) {
        case LE_START:
@@ -1290,8 +1295,6 @@ static int lfsck_assistant_notify_others(const struct lu_env *env,
                        LASSERT(ltd != NULL);
 
                        laia->laia_ltd = ltd;
-                       ltd->ltd_layout_done = 0;
-                       ltd->ltd_synced_failures = 0;
                        rc = lfsck_async_request(env, ltd->ltd_exp, lr, set,
                                        lfsck_async_interpret_common,
                                        laia, LFSCK_NOTIFY);
@@ -1574,6 +1577,7 @@ int lfsck_assistant_engine(void *args)
        }
 
        spin_lock(&lad->lad_lock);
+       lad->lad_task = current;
        thread_set_flags(athread, SVC_RUNNING);
        spin_unlock(&lad->lad_lock);
        wake_up_all(&mthread->t_ctl_waitq);
@@ -1817,6 +1821,7 @@ fini:
        lad->lad_assistant_status = (rc1 != 0 ? rc1 : rc);
        thread_set_flags(athread, SVC_STOPPED);
        wake_up_all(&mthread->t_ctl_waitq);
+       lad->lad_task = NULL;
        spin_unlock(&lad->lad_lock);
 
        CDEBUG(D_LFSCK, "%s: %s LFSCK assistant thread exit: rc = %d\n",