Whamcloud - gitweb
LU-6895 lfsck: not destroy directory when fix FID-in-dirent
[fs/lustre-release.git] / lustre / lfsck / lfsck_namespace.c
index d1b66a8..44ead75 100644 (file)
@@ -4356,7 +4356,7 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
                lfsck_pos_dump(m, &pos, "current_position");
        } else if (ns->ln_status == LS_SCANNING_PHASE2) {
                cfs_duration_t duration = cfs_time_current() -
-                                         lfsck->li_time_last_checkpoint;
+                                         com->lc_time_last_checkpoint;
                __u64 checked = ns->ln_objs_checked_phase2 +
                                com->lc_new_checked;
                __u64 speed1 = ns->ln_items_checked;
@@ -4660,7 +4660,7 @@ log:
               lr->lr_index, lr->lr_status, lr->lr_flags2);
 
        spin_lock(&ltds->ltd_lock);
-       ltd = LTD_TGT(ltds, lr->lr_index);
+       ltd = lfsck_ltd2tgt(ltds, lr->lr_index);
        if (ltd == NULL) {
                spin_unlock(&ltds->ltd_lock);
 
@@ -4988,7 +4988,7 @@ log:
               "name %s. %s: rc = %d\n", lfsck_lfsck2name(lfsck),
               PFID(lfsck_dto2fid(parent)), PFID(lfsck_dto2fid(child)),
               type, cname->ln_name,
-              create ? "Create the lost OST-object as required" :
+              create ? "Create the lost MDT-object as required" :
                        "Keep the MDT-object there by default", rc);
 
        if (rc <= 0) {
@@ -5009,6 +5009,7 @@ static int lfsck_namespace_assistant_handler_p1(const struct lu_env *env,
        struct lfsck_instance      *lfsck    = com->lc_lfsck;
        struct lfsck_bookmark      *bk       = &lfsck->li_bookmark_ram;
        struct lfsck_namespace     *ns       = com->lc_file_ram;
+       struct lfsck_assistant_data *lad     = com->lc_data;
        struct linkea_data          ldata    = { NULL };
        const struct lu_name       *cname;
        struct thandle             *handle   = NULL;
@@ -5026,6 +5027,7 @@ static int lfsck_namespace_assistant_handler_p1(const struct lu_env *env,
        bool                        newdata;
        bool                        log      = false;
        bool                        bad_hash = false;
+       bool                        bad_linkea = false;
        int                         idx      = 0;
        int                         count    = 0;
        int                         rc       = 0;
@@ -5111,7 +5113,7 @@ static int lfsck_namespace_assistant_handler_p1(const struct lu_env *env,
                        GOTO(out, rc);
                }
 
-               ltd = LTD_TGT(&lfsck->li_mdt_descs, idx);
+               ltd = lfsck_ltd2tgt(&lfsck->li_mdt_descs, idx);
                if (unlikely(ltd == NULL)) {
                        CDEBUG(D_LFSCK, "%s: cannot talk with MDT %x which "
                               "did not join the namespace LFSCK\n",
@@ -5160,7 +5162,7 @@ dangling:
                GOTO(out, rc);
        }
 
-       if (!(bk->lb_param & LPF_DRYRUN) && repaired) {
+       if (!(bk->lb_param & LPF_DRYRUN) && lad->lad_advance_lock) {
 
 again:
                rc = lfsck_ibits_lock(env, lfsck, obj, &lh,
@@ -5299,6 +5301,7 @@ nodata:
                if (rc != 0)
                        GOTO(stop, rc);
 
+               bad_linkea = true;
                if (!remove && newdata)
                        ns->ln_flags |= LF_UPGRADE;
                else if (remove || !(ns->ln_flags & LF_UPGRADE))
@@ -5513,6 +5516,8 @@ trace:
        if (dir != NULL && !IS_ERR(dir))
                lfsck_object_put(env, dir);
 
+       lad->lad_advance_lock = bad_linkea;
+
        return rc;
 }
 
@@ -6163,7 +6168,7 @@ static int lfsck_namespace_double_scan_result(const struct lu_env *env,
 
        down_write(&com->lc_sem);
        ns->ln_run_time_phase2 += cfs_duration_sec(cfs_time_current() +
-                               HALF_SEC - lfsck->li_time_last_checkpoint);
+                                 HALF_SEC - com->lc_time_last_checkpoint);
        ns->ln_time_last_checkpoint = cfs_time_current_sec();
        ns->ln_objs_checked_phase2 += com->lc_new_checked;
        com->lc_new_checked = 0;
@@ -6257,7 +6262,7 @@ static void lfsck_namespace_assistant_sync_failures(const struct lu_env *env,
 
        down_read(&ltds->ltd_rw_sem);
        cfs_foreach_bit(lad->lad_bitmap, idx) {
-               ltd = LTD_TGT(ltds, idx);
+               ltd = lfsck_ltd2tgt(ltds, idx);
                LASSERT(ltd != NULL);
 
                laia->laia_ltd = ltd;