From: wangdi Date: Tue, 24 Oct 2006 11:50:28 +0000 (+0000) Subject: Branch: b_new_cmd X-Git-Tag: v1_8_0_110~486^2~364 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0161dfffbd51250082b521857df985f298faaf28;p=fs%2Flustre-release.git Branch: b_new_cmd we should update cat log hdr only after we successfully create the new log, otherwise the index will be wrong, when disk full, which maybe cause lbug later --- diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 55039cc..6c61ff6 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -65,21 +65,10 @@ 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; } - + rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL); - if (rc) + if (rc) RETURN(ERR_PTR(rc)); rc = llog_init_handle(loghandle, @@ -88,6 +77,16 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle) 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);