From a830c06c612125cf517c66823078364c0c509de9 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Sat, 1 Aug 2015 19:10:58 +0300 Subject: [PATCH] LU-6714 llog: fix the llog_cat_set_first_idx() The bug was introduced in previous commit causing wrong catalog index to be set. Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes mdtfilesystemtype=ldiskfs mdsfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs clientdistro=el7 ossdistro=el6.6 mdsdistro=el6.6 mdtcount=1 testlist=performance-sanity Signed-off-by: Mikhail Pershin Change-Id: Iaa0747c5f504109f3a265c7cdda91ebe7ba83b4f Reviewed-on: http://review.whamcloud.com/15841 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/llog_cat.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index e1ad2cd..981af6f 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -764,20 +764,21 @@ static int llog_cat_set_first_idx(struct llog_handle *cathandle, int idx) if (llh->llh_cat_idx == (idx - 1)) { llh->llh_cat_idx = idx; - do { + while (idx != cathandle->lgh_last_idx) { idx = (idx + 1) % bitmap_size; if (!ext2_test_bit(idx, LLOG_HDR_BITMAP(llh))) { /* update llh_cat_idx for each unset bit, - * expecting the*/ + * expecting the next one is set */ llh->llh_cat_idx = idx; } else if (idx == 0) { /* skip header bit */ + llh->llh_cat_idx = 0; continue; } else { /* the first index is found */ break; } - } while (idx != cathandle->lgh_last_idx); + } CDEBUG(D_RPCTRACE, "Set catlog "DOSTID" first idx %u," " (last_idx %u)\n", POSTID(&cathandle->lgh_id.lgl_oi), -- 1.8.3.1