Whamcloud - gitweb
LU-12961 mdd: avoid double call to mdd_changelog_fini() 37/36737/11
authorAlex Zhuravlev <bzzz@whamcloud.com>
Tue, 12 Nov 2019 17:45:50 +0000 (20:45 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 08:25:27 +0000 (08:25 +0000)
the first call is done from mdd_prepare() as part of error
handling, another call is done from mdd_device_shutdown().

in the similar cases fini routines checks whether the state
is initialized. e.g. mdd_orphan_index_fini() releases the
object and sets mdd_orphans to NULL, then all subsequent
calls to mdd_orphan_index_fini() return immediately.
mdd_changelog_fini() can't do this way, so the excplicit
state has been introduced.

Change-Id: Ifd21569e68c836f44bb59adea4e8fed6ccef1c7b
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/36737
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
lustre/mdd/mdd_device.c
lustre/mdd/mdd_internal.h

index cd03553..14d812a 100644 (file)
@@ -598,7 +598,9 @@ static void mdd_changelog_fini(const struct lu_env *env,
        struct obd_device       *obd = mdd2obd_dev(mdd);
        struct llog_ctxt        *ctxt;
 
-       mdd->mdd_cl.mc_flags = 0;
+       if (mdd->mdd_cl.mc_flags & CLM_CLEANUP_DONE)
+               return;
+       mdd->mdd_cl.mc_flags = CLM_CLEANUP_DONE;
 
 again:
        /* stop GC-thread if running */
index aa7016e..b06c021 100644 (file)
@@ -80,6 +80,8 @@
 #define CLM_FINI  0x20000
 /** some changelog records purged */
 #define CLM_PURGE 0x40000
+/** changelog cleanup done, to prevent double cleanup */
+#define CLM_CLEANUP_DONE 0x80000
 
 #define LLOG_CHANGELOG_HDR_SZ (sizeof(struct llog_changelog_rec) - \
                               sizeof(struct changelog_rec))