Skip to content

Commit 2d1d453

Browse files
Solaryeegregkh
authored andcommitted
staging: lustre: llite: don't invoke direct_IO for the EOF case
[ 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@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8969 Reviewed-on: https://review.whamcloud.com/24552 Reviewed-by: Bob Glossman <bob.glossman@intel.com> Reviewed-by: Bobi Jam <bobijam@hotmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 28a8fc6 commit 2d1d453

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • drivers/staging/lustre/lustre/llite

drivers/staging/lustre/lustre/llite/rw26.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter,
376376
if (!lli->lli_has_smd)
377377
return -EBADF;
378378

379+
/* Check EOF by ourselves */
380+
if (iov_iter_rw(iter) == READ && file_offset >= i_size_read(inode))
381+
return 0;
382+
379383
/* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */
380384
if ((file_offset & ~CFS_PAGE_MASK) || (count & ~CFS_PAGE_MASK))
381385
return -EINVAL;

0 commit comments

Comments
 (0)