From c5165557f561c13d83b355f4118d6c4564b5d036 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 12 Nov 2019 20:45:50 +0300 Subject: [PATCH] LU-12961 mdd: avoid double call to mdd_changelog_fini() 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 Reviewed-on: https://review.whamcloud.com/36737 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- lustre/mdd/mdd_device.c | 4 +++- lustre/mdd/mdd_internal.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index cd03553..14d812a 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -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 */ diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index aa7016e..b06c021 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -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)) -- 1.8.3.1