Whamcloud - gitweb
LU-11591 llog: add synchronization for the last record 07/34507/2
authorAlexander Boyko <c17825@cray.com>
Thu, 29 Nov 2018 13:58:30 +0000 (08:58 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Apr 2019 06:27:53 +0000 (06:27 +0000)
commit15d4ffba21dc9d18c3cba6dfcb134112d010e022
tree4e51e24e894d722c53b9c1ac86c1aaa3b8f1cc77
parente07209112efbcfc86882cb4dcc3e78fff4a3e982
LU-11591 llog: add synchronization for the last record

The initial problem was a race between llog_process_thread
and llog_osd_write_rec for a last record with lgh_last_idx.
The catalog should be wrapped for the problem. The lgh_last_idx
could be increased with a modification of llog bitmap, and a writing
record happen a bit later. When llog_process_thread processing
lgh_last_idx after modification and before a write it operates
with old record data.

The patch adds synchronization when lgh_last_idx is processed.

The patch changes llog_test 10h to check race between
llog_process_thread and llog_osd_write_rec.

1 Thread with write                  2 Thread with read
llog_osd_write_rec()                llog_process_thread()
lgh_last_idx++
lock lgh_hdr_mutex
ext2_set_bit()
dt_write_rec (write header)         ext2_test_bit()
         check lgh_last_idx was changed
         dt_read_rec()
         reread the record, and here we
         got the old value of record
unlock lgh_hdr_mutex
dt_write_rec (write the record)

Lustre-change: https://review.whamcloud.com/33683
Lustre-commit: ec4194e4e78c959ace97afeacd580d3609658115

This patch also include LU-11975 test: fix for llog test 10h

Lustre-change: https://review.whamcloud.com/#/c/34287/
Lustre-commit: 0670d5aed457196121c843fd24877d3f2670d478

Signed-off-by: Alexander Boyko <c17825@cray.com>
Cray-bug-id: LUS-6683
Change-Id: I642b488655940b9456ca8e2f2174c98a966ba242
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alexander Zarochentsev <c17826@cray.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/34507
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_log.h
lustre/obdclass/llog.c
lustre/obdclass/llog_cat.c
lustre/obdclass/llog_osd.c
lustre/obdclass/llog_test.c
lustre/tests/sanity.sh