From: Lai Siyao Date: Tue, 15 Aug 2017 11:51:08 +0000 (+0800) Subject: LU-9848 llog: check padding size for update reclen X-Git-Tag: 2.10.53~61 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6705d6cc40a83b0e94668d651c444c855482bd01 LU-9848 llog: check padding size for update reclen Update log only checks padding size for split case, which should also be done if it's less than chunk size. Signed-off-by: Lai Siyao Change-Id: Ie7819f67dd9bcbfb060713bb208c9777420c5178 Reviewed-on: https://review.whamcloud.com/28554 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- diff --git a/lustre/target/update_trans.c b/lustre/target/update_trans.c index 36ab331..76153b1 100644 --- a/lustre/target/update_trans.c +++ b/lustre/target/update_trans.c @@ -201,7 +201,17 @@ static int sub_updates_write(const struct lu_env *env, "lrh_len %u record_size %zu\n", record->lur_hdr.lrh_len, llog_update_record_size(record)); - if (likely(record->lur_hdr.lrh_len <= ctxt->loc_chunk_size)) { + /* + * If its size > llog chunk_size, then write current chunk to the update + * llog, NB the padding should >= LLOG_MIN_REC_SIZE. + * + * So check padding length is either >= LLOG_MIN_REC_SIZE or is 0 + * (record length just matches the chunk size). + */ + + reclen = record->lur_hdr.lrh_len; + if (reclen + LLOG_MIN_REC_SIZE <= ctxt->loc_chunk_size || + reclen == ctxt->loc_chunk_size) { OBD_ALLOC_PTR(stc); if (stc == NULL) GOTO(llog_put, rc = -ENOMEM); @@ -245,13 +255,6 @@ static int sub_updates_write(const struct lu_env *env, else eof = true; - /* - * If its size > llog chunk_size, then write current chunk to - * the update llog, NB the padding should >= LLOG_MIN_REC_SIZE. - * - * So check padding length is either >= LLOG_MIN_REC_SIZE or is - * 0 (record length just matches the chunk size). - */ reclen = __llog_update_record_size( __update_records_size(next - start)); if ((reclen + LLOG_MIN_REC_SIZE <= ctxt->loc_chunk_size ||