Whamcloud - gitweb
LU-14132 lod: do not initialize sub llogs twice 05/40605/12
authorAlex Zhuravlev <bzzz@whamcloud.com>
Wed, 11 Nov 2020 08:00:23 +0000 (11:00 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Apr 2021 03:02:11 +0000 (03:02 +0000)
this can happen during MDT re-activation and then result in leaked
objects:
lod_device_free()) ASSERTION( atomic_read(&lu->ld_ref) == 0 )

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I0afb335ffb20532f9171dd2e514100b12f4d9a76
Reviewed-on: https://review.whamcloud.com/40605
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/lod/lod_sub_object.c

index e2eb8d7..3e8d822 100644 (file)
@@ -936,6 +936,12 @@ int lod_sub_prep_llog(const struct lu_env *env, struct lod_device *lod,
        obd = dt->dd_lu_dev.ld_obd;
        ctxt = llog_get_context(obd, LLOG_UPDATELOG_ORIG_CTXT);
        LASSERT(ctxt != NULL);
        obd = dt->dd_lu_dev.ld_obd;
        ctxt = llog_get_context(obd, LLOG_UPDATELOG_ORIG_CTXT);
        LASSERT(ctxt != NULL);
+       /* concurrent config processing (e.g. setting MDT active)
+        * can try to initialize llog again before causing double
+        * initialization. check for this */
+       if (ctxt->loc_handle)
+               GOTO(out_put, rc = 0);
+
        ctxt->loc_flags |= LLOG_CTXT_FLAG_NORMAL_FID;
        ctxt->loc_chunk_size = LLOG_MIN_CHUNK_SIZE * 4;
        if (likely(logid_id(&cid->lci_logid) != 0)) {
        ctxt->loc_flags |= LLOG_CTXT_FLAG_NORMAL_FID;
        ctxt->loc_chunk_size = LLOG_MIN_CHUNK_SIZE * 4;
        if (likely(logid_id(&cid->lci_logid) != 0)) {