Whamcloud - gitweb
- make HEAD from b_post_cmd3
[fs/lustre-release.git] / lustre / obdclass / llog_cat.c
index 9fe257a..a757e68 100644 (file)
@@ -65,29 +65,32 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
         if (llh->llh_cat_idx == index) {
                 CERROR("no free catalog slots for log...\n");
                 RETURN(ERR_PTR(-ENOSPC));
-        } else {
-                if (index == 0)
-                        index = 1;
-                if (ext2_set_bit(index, llh->llh_bitmap)) {
-                        CERROR("argh, index %u already set in log bitmap?\n",
-                               index);
-                        LBUG(); /* should never happen */
-                }
-                cathandle->lgh_last_idx = index;
-                llh->llh_count++;
-                llh->llh_tail.lrt_index = index;
         }
 
+        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
+                RETURN(ERR_PTR(-ENOSPC));
         rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL);
-        if (rc)
+        if (rc) 
                 RETURN(ERR_PTR(rc));
-
+        
         rc = llog_init_handle(loghandle,
                               LLOG_F_IS_PLAIN | LLOG_F_ZAP_WHEN_EMPTY,
                               &cathandle->lgh_hdr->llh_tgtuuid);
         if (rc)
                 GOTO(out_destroy, rc);
 
+        if (index == 0)
+                index = 1;
+        if (ext2_set_bit(index, llh->llh_bitmap)) {
+                CERROR("argh, index %u already set in log bitmap?\n",
+                       index);
+                LBUG(); /* should never happen */
+        }
+        cathandle->lgh_last_idx = index;
+        llh->llh_count++;
+        llh->llh_tail.lrt_index = index;
+
         CDEBUG(D_HA, "new recovery log "LPX64":%x for index %u of catalog "
                LPX64"\n", loghandle->lgh_id.lgl_oid, loghandle->lgh_id.lgl_ogen,
                index, cathandle->lgh_id.lgl_oid);