Whamcloud - gitweb
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)
Signed-off-by: Alexander Boyko <c17825@cray.com>
Cray-bug-id: LUS-6683
Change-Id: I642b488655940b9456ca8e2f2174c98a966ba242
Reviewed-on: https://review.whamcloud.com/33683
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alexander Zarochentsev <c17826@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>