Whamcloud - gitweb
LU-3764 tests: Make calls to error_ignore not trigger FAIL
[fs/lustre-release.git] / lustre / lfsck / lfsck_lib.c
index 337bd8c..0da2614 100644 (file)
@@ -206,11 +206,6 @@ static void lfsck_instance_cleanup(const struct lu_env *env,
                lfsck->li_los = NULL;
        }
 
-       if (lfsck->li_local_root != NULL) {
-               lu_object_put_nocache(env, &lfsck->li_local_root->do_lu);
-               lfsck->li_local_root = NULL;
-       }
-
        OBD_FREE_PTR(lfsck);
 }
 
@@ -481,8 +476,7 @@ static int lfsck_needs_scan_dir(const struct lu_env *env,
                if (rc != 0)
                        return rc;
 
-               if (unlikely(lu_fid_eq(fid,
-                                      lfsck_dto2fid(lfsck->li_local_root))))
+               if (unlikely(lu_fid_eq(fid, &lfsck->li_local_root_fid)))
                        return 0;
 
                obj = lfsck_object_find(env, lfsck, fid);
@@ -928,6 +922,10 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
        }
 
        if (start->ls_valid & LSV_DRYRUN) {
+               valid |= DOIV_DRYRUN;
+               if (start->ls_flags & LPF_DRYRUN)
+                       flags |= DOIF_DRYRUN;
+
                if ((start->ls_flags & LPF_DRYRUN) &&
                    !(bk->lb_param & LPF_DRYRUN)) {
                        bk->lb_param |= LPF_DRYRUN;
@@ -1000,8 +998,11 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
 
 trigger:
        lfsck->li_args_dir = LUDA_64BITHASH | LUDA_VERIFY;
-       if (bk->lb_param & LPF_DRYRUN)
+       if (bk->lb_param & LPF_DRYRUN) {
                lfsck->li_args_dir |= LUDA_VERIFY_DRYRUN;
+               valid |= DOIV_DRYRUN;
+               flags |= DOIF_DRYRUN;
+       }
 
        if (bk->lb_param & LPF_FAILOUT) {
                valid |= DOIV_ERROR_HANDLE;
@@ -1076,7 +1077,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
                   struct dt_device *next, bool master)
 {
        struct lfsck_instance   *lfsck;
-       struct dt_object        *root;
+       struct dt_object        *root  = NULL;
        struct dt_object        *obj;
        struct lu_fid           *fid   = &lfsck_env_info(env)->lti_fid;
        int                      rc;
@@ -1117,7 +1118,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
        if (IS_ERR(root))
                GOTO(out, rc = PTR_ERR(root));
 
-       lfsck->li_local_root = root;
+       lfsck->li_local_root_fid = *fid;
         dt_try_as_dir(env, root);
        if (master) {
                lfsck->li_master = 1;
@@ -1161,6 +1162,8 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
 add:
        rc = lfsck_instance_add(lfsck);
 out:
+       if (root != NULL && !IS_ERR(root))
+               lu_object_put(env, &root->do_lu);
        if (rc != 0)
                lfsck_instance_cleanup(env, lfsck);
        return rc;