Whamcloud - gitweb
LU-12420 utils: llog_reader handles uninitialized llog properly 02/48302/2
authorLi Xi <lixi@ddn.com>
Tue, 11 Jun 2019 08:26:22 +0000 (16:26 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Feb 2024 05:45:33 +0000 (05:45 +0000)
commitb2707288b4f7f795820aa7c4406784d35d2b7613
treee38af23ca825d7c15acbf97741873b9aaa187c27
parent05219f018167fd2731255e56fd72b078958af639
LU-12420 utils: llog_reader handles uninitialized llog properly

When reading an empty LLOG, llog_reader would crash because
of record number of zero. E.g. "llog_reader CONFIGS/nodemap" on
a MGS without nodemap configuration would cause failure of:

llog_reader: Error allocating -16 bytes for recs_buf: Cannot allocate memory (12)
llog_reader: Could not pack buffer.: Cannot allocate memory (12)

After apply this patch, llog_reader will print following message
and quit if the LLOG is unintialized:

uninitialized llog: zero record number

Lustre-change: https://review.whamcloud.com/35177
Lustre-commit: 94a16a027536100a9d0a279e1f384076a7a9b513

Change-Id: I87246672e9fc992c99126134236c2e8d304df74b
Signed-off-by: Li Xi <lixi@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48302
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/llog_reader.c