Whamcloud - gitweb
LU-3536 lod: cancel update log after all committed
[fs/lustre-release.git] / lustre / obdclass / llog_cat.c
index c8c2da3..bc5c126 100644 (file)
@@ -72,6 +72,14 @@ static int llog_cat_new_log(const struct lu_env *env,
        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
                RETURN(-ENOSPC);
 
+       if (loghandle->lgh_hdr != NULL) {
+               /* If llog object is remote and creation is failed, lgh_hdr
+                * might be left over here, free it first */
+               LASSERT(!llog_exist(loghandle));
+               OBD_FREE_PTR(loghandle->lgh_hdr);
+               loghandle->lgh_hdr = NULL;
+       }
+
        rc = llog_create(env, loghandle, th);
        /* if llog is already created, no need to initialize it */
        if (rc == -EEXIST) {