Whamcloud - gitweb
LU-3963 Revert bitops changes
[fs/lustre-release.git] / lustre / ofd / ofd_dev.c
index a8f193b..3166fb7 100644 (file)
@@ -1172,6 +1172,9 @@ static int ofd_orphans_destroy(const struct lu_env *env,
        LASSERT(exp != NULL);
        skip_orphan = !!(exp_connect_flags(exp) & OBD_CONNECT_SKIP_ORPHAN);
 
+       if (OBD_FAIL_CHECK(OBD_FAIL_OST_NODESTROY))
+               goto done;
+
        LCONSOLE(D_INFO, "%s: deleting orphan objects from "DOSTID
                 " to "DOSTID"\n", ofd_name(ofd), seq, end_id + 1, seq, last);
 
@@ -1181,9 +1184,12 @@ static int ofd_orphans_destroy(const struct lu_env *env,
                        GOTO(out_put, rc);
 
                rc = ofd_destroy_by_fid(env, ofd, fid, 1);
-               if (rc != 0 && rc != -ENOENT) /* this is pretty fatal... */
-                       CEMERG("%s: error destroying precreated id "DFID
-                              ": rc = %d\n", ofd_name(ofd), PFID(fid), rc);
+               if (rc != 0 && rc != -ENOENT && rc != -ESTALE &&
+                   likely(rc != -EREMCHG && rc != -EINPROGRESS))
+                       /* this is pretty fatal... */
+                       CEMERG("%s: error destroying precreated id "
+                              DFID": rc = %d\n",
+                              ofd_name(ofd), PFID(fid), rc);
 
                oid--;
                if (!skip_orphan) {
@@ -1199,7 +1205,9 @@ static int ofd_orphans_destroy(const struct lu_env *env,
        CDEBUG(D_HA, "%s: after destroy: set last_id to "DOSTID"\n",
               ofd_name(ofd), seq, oid);
 
+done:
        if (!skip_orphan) {
+               ofd_seq_last_oid_set(oseq, oid);
                rc = ofd_seq_last_oid_write(env, ofd, oseq);
        } else {
                /* don't reuse orphan object, return last used objid */
@@ -1656,7 +1664,7 @@ static int ofd_punch_hdl(struct tgt_session_info *tsi)
        }
 
        rc = ofd_object_punch(tsi->tsi_env, fo, start, end, &info->fti_attr,
-                             ff);
+                             ff, (struct obdo *)oa);
        if (rc)
                GOTO(out_put, rc);
 
@@ -2128,6 +2136,9 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
        m->ofd_tot_granted = 0;
        m->ofd_tot_pending = 0;
        m->ofd_seq_count = 0;
+       init_waitqueue_head(&m->ofd_inconsistency_thread.t_ctl_waitq);
+       INIT_LIST_HEAD(&m->ofd_inconsistency_list);
+       spin_lock_init(&m->ofd_inconsistency_lock);
 
        spin_lock_init(&m->ofd_batch_lock);
        rwlock_init(&obd->u.filter.fo_sptlrpc_lock);
@@ -2232,7 +2243,14 @@ static int ofd_init0(const struct lu_env *env, struct ofd_device *m,
        if (rc)
                GOTO(err_fini_lut, rc);
 
+       rc = ofd_start_inconsistency_verification_thread(m);
+       if (rc != 0)
+               GOTO(err_fini_fs, rc);
+
        RETURN(0);
+
+err_fini_fs:
+       ofd_fs_cleanup(env, m);
 err_fini_lut:
        tgt_fini(env, &m->ofd_lut);
 err_free_ns:
@@ -2254,12 +2272,13 @@ static void ofd_fini(const struct lu_env *env, struct ofd_device *m)
        stop.ls_status = LS_PAUSED;
        stop.ls_flags = 0;
        lfsck_stop(env, m->ofd_osd, &stop);
-       lfsck_degister(env, m->ofd_osd);
        target_recovery_fini(obd);
        obd_exports_barrier(obd);
        obd_zombie_barrier();
 
        tgt_fini(env, &m->ofd_lut);
+       ofd_stop_inconsistency_verification_thread(m);
+       lfsck_degister(env, m->ofd_osd);
        ofd_fs_cleanup(env, m);
 
        ofd_free_capa_keys(m);