This is a note to let you know that I've just added the patch titled staging: lustre: llite: don't invoke direct_IO for the EOF case to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-lustre-llite-don-t-invoke-direct_io-for-the-eof-case.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Nov 6 10:07:35 CET 2017 From: Yang Sheng <yang.sheng@xxxxxxxxx> Date: Sat, 7 Oct 2017 22:36:54 +0000 Subject: staging: lustre: llite: don't invoke direct_IO for the EOF case From: Yang Sheng <yang.sheng@xxxxxxxxx> [ Upstream commit 77759771fb95420d23876cb104ab65c022613325 ] The function generic_file_read_iter() does not check EOF before invoke direct_IO callback. So we have to check it ourselves. Signed-off-by: Yang Sheng <yang.sheng@xxxxxxxxx> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8969 Reviewed-on: https://review.whamcloud.com/24552 Reviewed-by: Bob Glossman <bob.glossman@xxxxxxxxx> Reviewed-by: Bobi Jam <bobijam@xxxxxxxxxxx> Reviewed-by: Oleg Drokin <oleg.drokin@xxxxxxxxx> Signed-off-by: James Simmons <jsimmons@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/lustre/lustre/llite/rw26.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -354,6 +354,10 @@ static ssize_t ll_direct_IO_26(struct ki if (!lli->lli_has_smd) return -EBADF; + /* Check EOF by ourselves */ + if (iov_iter_rw(iter) == READ && file_offset >= i_size_read(inode)) + return 0; + /* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */ if ((file_offset & ~PAGE_MASK) || (count & ~PAGE_MASK)) return -EINVAL; Patches currently in stable-queue which might be from yang.sheng@xxxxxxxxx are queue-4.9/staging-lustre-llite-don-t-invoke-direct_io-for-the-eof-case.patch