diff --git a/lustre/ChangeLog b/lustre/ChangeLog index d35af16e211548610ef5f055ae9f643d13ecb058..8a05fe978e62329f45bfa8dcbda7639117ae77ae 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -591,6 +591,12 @@ Details : FIEMAP ioctl will allow an application to efficiently fetch the extent information of a file. It can be used to map logical blocks in a file to physical blocks in the block device. +Severity : minor +Bugzilla : 16717 +Description: LBUG when llog conf file is full +Details : When llog bitmap is full, ENOSPC should be returned for plain + log. + ------------------------------------------------------------------------------- diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index 4042bb5fd77a0283122c14f74cdb30cd3240f7f1..20b20126e268cf2dfaa9b25cee93b50dda18b3cc 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -323,18 +323,16 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, /* NOTE: padding is a record, but no bit is set */ if (left != 0 && left != reclen && left < (reclen + LLOG_MIN_REC_SIZE)) { - loghandle->lgh_last_idx++; - rc = llog_lvfs_pad(obd, file, left, loghandle->lgh_last_idx); + index = loghandle->lgh_last_idx + 1; + rc = llog_lvfs_pad(obd, file, left, index); if (rc) RETURN(rc); - /* if it's the last idx in log file, then return -ENOSPC */ - if (loghandle->lgh_last_idx == LLOG_BITMAP_SIZE(llh) - 1) - RETURN(-ENOSPC); + loghandle->lgh_last_idx++; /*for pad rec*/ } - - loghandle->lgh_last_idx++; - index = loghandle->lgh_last_idx; - LASSERT(index < LLOG_BITMAP_SIZE(llh)); + /* if it's the last idx in log file, then return -ENOSPC */ + if (loghandle->lgh_last_idx >= LLOG_BITMAP_SIZE(llh) - 1) + RETURN(-ENOSPC); + index = ++loghandle->lgh_last_idx; rec->lrh_index = index; if (buf == NULL) { lrt = (struct llog_rec_tail *) @@ -342,6 +340,9 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, lrt->lrt_len = rec->lrh_len; lrt->lrt_index = rec->lrh_index; } + /*The caller should make sure only 1 process access the lgh_last_idx, + *Otherwise it might hit the assert.*/ + LASSERT(index < LLOG_BITMAP_SIZE(llh)); if (ext2_set_bit(index, llh->llh_bitmap)) { CERROR("argh, index %u already set in log bitmap?\n", index); LBUG(); /* should never happen */