X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_osd.c;fp=lustre%2Fobdclass%2Fllog_osd.c;h=f25126d7d8463af4170ebfcc72371add0285261a;hp=2fee9d80038362b40d170063f6fedcb87448fcd2;hb=01fb4edfd7bde7e495e767c5321235565cfadaee;hpb=196855e15489b4460780d2b098115b943ec6c375 diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 2fee9d8..f25126d 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -822,8 +822,26 @@ static void changelog_block_trim_ext(struct llog_rec_hdr *hdr, extra_flags; } + if (unlikely(hdr->lrh_len == 0)) { + /* It is corruption case, we cannot know the next rec, + * jump to the last one directly to avoid dead loop. */ + LCONSOLE(D_WARNING, "Hit invalid llog record: " + "idx %u, type %u, id %u\n", + hdr->lrh_index, hdr->lrh_type, hdr->lrh_id); + hdr = llog_rec_hdr_next(last_hdr); + if (unlikely(hdr == last_hdr)) + LCONSOLE(D_WARNING, "The last record crashed: " + "idx %u, type %u, id %u\n", + hdr->lrh_index, hdr->lrh_type, + hdr->lrh_id); + break; + } + changelog_remap_rec(rec, rec->cr_flags & flags, xflag); hdr = llog_rec_hdr_next(hdr); + /* Yield CPU to avoid soft-lockup if there are too many records + * to be handled. */ + cond_resched(); } while ((char *)hdr <= (char *)last_hdr); }