Whamcloud - gitweb
LU-8382 hsm: reorder coordinator's cleanup functions 07/21207/8
authorQuentin Bouget <quentin.bouget.ocre@cea.fr>
Wed, 10 Aug 2016 21:02:14 +0000 (23:02 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 31 Jan 2017 04:07:49 +0000 (04:07 +0000)
The functions to initialize the coordinator and its proc entries
were called in the same order as the cleanup ones.
This patch reorders the cleanup functions called in mdt_fini()
according to the error path of mdt_init0().

Signed-off-by: Quentin Bouget <quentin.bouget.ocre@cea.fr>
Change-Id: Ic242b8f02cf44f900541446964297982ad6fc178
Reviewed-on: https://review.whamcloud.com/21207
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c

index f134fc0..e5da354 100644 (file)
@@ -4506,12 +4506,12 @@ static struct tgt_opc_slice mdt_common_slice[] = {
 
 static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
 {
-       struct md_device        *next = m->mdt_child;
-       struct lu_device        *d    = &m->mdt_lu_dev;
-       struct obd_device       *obd  = mdt2obd_dev(m);
-       struct lfsck_stop        stop;
-       ENTRY;
+       struct md_device *next = m->mdt_child;
+       struct lu_device *d = &m->mdt_lu_dev;
+       struct obd_device *obd = mdt2obd_dev(m);
+       struct lfsck_stop stop;
 
+       ENTRY;
        stop.ls_status = LS_PAUSED;
        stop.ls_flags = 0;
        next->md_ops->mdo_iocontrol(env, next, OBD_IOC_STOP_LFSCK, 0, &stop);
@@ -4522,24 +4522,34 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
        if (m->mdt_opts.mo_coordinator)
                mdt_hsm_cdt_stop(m);
 
-       mdt_hsm_cdt_fini(m);
-
        mdt_llog_ctxt_unclone(env, m, LLOG_AGENT_ORIG_CTXT);
-        mdt_llog_ctxt_unclone(env, m, LLOG_CHANGELOG_ORIG_CTXT);
+       mdt_llog_ctxt_unclone(env, m, LLOG_CHANGELOG_ORIG_CTXT);
 
        if (m->mdt_namespace != NULL)
                ldlm_namespace_free_prior(m->mdt_namespace, NULL,
                                          d->ld_obd->obd_force);
 
-        obd_exports_barrier(obd);
-        obd_zombie_barrier();
+       obd_exports_barrier(obd);
+       obd_zombie_barrier();
+
+       mdt_quota_fini(env, m);
+
+       cfs_free_nidlist(&m->mdt_squash.rsi_nosquash_nids);
+
+       /* Calling the cleanup functions in the same order as in the mdt_init0
+        * error path
+        */
+       mdt_procfs_fini(m);
+
+       target_recovery_fini(obd);
+       upcall_cache_cleanup(m->mdt_identity_cache);
+       m->mdt_identity_cache = NULL;
 
-        mdt_procfs_fini(m);
+       mdt_fs_cleanup(env, m);
+
+       tgt_fini(env, &m->mdt_lut);
 
-        tgt_fini(env, &m->mdt_lut);
-        mdt_fs_cleanup(env, m);
-        upcall_cache_cleanup(m->mdt_identity_cache);
-        m->mdt_identity_cache = NULL;
+       mdt_hsm_cdt_fini(m);
 
        if (m->mdt_namespace != NULL) {
                ldlm_namespace_free_post(m->mdt_namespace);
@@ -4551,12 +4561,9 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
                m->mdt_md_root = NULL;
        }
 
-       mdt_quota_fini(env, m);
-
-       cfs_free_nidlist(&m->mdt_squash.rsi_nosquash_nids);
+       mdt_seq_fini(env, m);
 
-        mdt_seq_fini(env, m);
-        mdt_fld_fini(env, m);
+       mdt_fld_fini(env, m);
 
        /*
         * Finish the stack