Whamcloud - gitweb
LU-12420 utils: llog_reader handles uninitialized llog properly 77/35177/3
authorLi Xi <lixi@ddn.com>
Tue, 11 Jun 2019 08:26:22 +0000 (16:26 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2019 01:55:25 +0000 (01:55 +0000)
commit94a16a027536100a9d0a279e1f384076a7a9b513
treea78f3bc2e9b9abe4da2fb0f78ec46efed2120b5f
parente9a543b0d3039027423cb469525015f97caa3a3f
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

Change-Id: I87246672e9fc992c99126134236c2e8d304df74b
Signed-off-by: Li Xi <lixi@ddn.com>
Reviewed-on: https://review.whamcloud.com/35177
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/llog_reader.c