Whamcloud - gitweb
LU-16579 llite: fix the wrong beyond read end calculation 65/50065/5
authorQian Yingjin <qian@ddn.com>
Mon, 20 Feb 2023 03:11:54 +0000 (22:11 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 21 Mar 2023 23:10:42 +0000 (23:10 +0000)
commitae356dc325877bd130ad94acc5f3610898de8a8a
treebd3b8b2be93fa3f5c2e1a82fddb2d5ed069d627c
parent32c219578bf3019076498eafbee6480b0adbb408
LU-16579 llite: fix the wrong beyond read end calculation

During the test, we found a dead loop in the read path which
retruns AOP_TRUNCATED_PAGE(0x8001) endless.
The reason is that the calculation of the ending beyond offset is
wrong: (iter->count + iocb->ki_pos).
The ending beyond offset was supposed to be not changed during
the read I/O loop for each page in buffered I/O mode.
However, @iter->count is decreased with read bytes when finished
the read of each page: @iter->count -= read_bytes.

In this patch, we store the ending beyond page index in
@lcc->lcc_end_index before call @generic_file_read_iter into a
loop for each read page and solve this bug.

Fixes: 2f8f38effa ("LU-16412 llite: check read page past requested")
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I5bb7ab82e5e2de8b9bd911798fb8ae65fc7c91af
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50065
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/llite_internal.h
lustre/llite/rw.c
lustre/llite/vvp_io.c