From c5a77bc13d82121bfa726f10e0384ff4c02c3f82 Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 5 Sep 2008 08:02:58 +0000 Subject: [PATCH] Branch:HEAD b=16717 fix lbug when conf log is full i=nathan,umka --- lustre/ChangeLog | 6 ++++++ lustre/obdclass/llog_lvfs.c | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 78b092c..7be55df 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -12,6 +12,12 @@ tbd Sun Microsystems, Inc. * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a removed cwd "./" (refer to Bugzilla 14399). +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. + Severity : normal Bugzilla : 16907 Description: Prevent import from entering FULL state when server in recovery diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index 0dbfd5c..4f3c913 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -324,15 +324,15 @@ 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); - 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); - } - + index = loghandle->lgh_last_idx + 1; + rc = llog_lvfs_pad(obd, file, left, index); + if (rc) + RETURN(rc); + loghandle->lgh_last_idx++; /*for pad rec*/ + } + /* 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++; index = loghandle->lgh_last_idx; LASSERT(index < LLOG_BITMAP_SIZE(llh)); @@ -343,6 +343,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 */ @@ -358,7 +361,7 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, if (rc) RETURN(rc); - CDEBUG(D_RPCTRACE, "added record "LPX64": idx: %u, %u bytes\n", + CDEBUG(D_RPCTRACE, "added record "LPX64": idx: %u, %u \n", loghandle->lgh_id.lgl_oid, index, rec->lrh_len); if (rc == 0 && reccookie) { reccookie->lgc_lgl = loghandle->lgh_id; -- 1.8.3.1