Whamcloud - gitweb
b=17447
[fs/lustre-release.git] / lustre / mds / mds_log.c
index 0e8447f..705d730 100644 (file)
@@ -118,6 +118,7 @@ int mds_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
                   struct obd_uuid *uuid)
 {
         struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
+        struct llog_ctxt *ctxt;
         int rc;
         ENTRY;
 
@@ -130,13 +131,24 @@ int mds_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
         rc = llog_setup(obd, &obd->obd_olg, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL,
                         &mds_size_repl_logops);
         if (rc)
-                RETURN(rc);
+                GOTO(err_llog, rc);
 
         rc = obd_llog_init(lov_obd, &lov_obd->obd_olg, tgt, count, logid, uuid);
-        if (rc)
+        if (rc) {
                 CERROR("lov_llog_init err %d\n", rc);
+                GOTO(err_cleanup, rc);
+        }
 
         RETURN(rc);
+err_cleanup:
+        ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT);
+        if (ctxt)
+                llog_cleanup(ctxt);
+err_llog:
+        ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
+        if (ctxt)
+                llog_cleanup(ctxt);
+        return rc;
 }
 
 int mds_llog_finish(struct obd_device *obd, int count)