diff --git a/lustre/ChangeLog b/lustre/ChangeLog index f9df72c19affe1256b75380db1f5be18c6b8200a..2d53e4f5c969c58e869339d9098965ef12f0e482 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -247,6 +247,13 @@ Details : in some rare cases, the open intent error is not checked before ASSERTION(open_req->rq_transno != 0), because it tries to release the failed open handle. +Severity : normal +Frequency : rare +Bugzilla : 12556 +Description: Set cat log bitmap only after create log success. +Details : in some rare cases, the cat log bitmap is set too early. and it + should be set only after create log success. + -------------------------------------------------------------------------------- 2007-05-03 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index c514d165d17a10163514332da1be6ca298187900..10678f895b573e2e1fe4abe1a4e0cb38ff33539d 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -100,6 +100,7 @@ extern int obd_race_state; #define OBD_FAIL_MDS_SETXATTR_WRITE 0x134 #define OBD_FAIL_MDS_FS_SETUP 0x135 #define OBD_FAIL_MDS_RESEND 0x136 +#define OBD_FAIL_MDS_LLOG_CREATE_FAILED 0x137 #define OBD_FAIL_OST 0x200 #define OBD_FAIL_OST_CONNECT_NET 0x201 diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 9fe257a5bda068e7a384416129bfdde26c4dca35..e42fab86ba45ffb7829cde53666b32d0637f7aa5 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -65,28 +65,30 @@ 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) 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,