]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: lustre: llite: don't invoke direct_IO for the EOF case
authorYang Sheng <yang.sheng@intel.com>
Sun, 29 Jan 2017 00:05:24 +0000 (19:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Feb 2017 12:01:38 +0000 (13:01 +0100)
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>
drivers/staging/lustre/lustre/llite/rw26.c

index 21e06e5b514e851b0ab2cdee97578ddf43808729..d89e79599199db8311e0de7c6231ecc10a00c6a9 100644 (file)
@@ -345,6 +345,10 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter)
        ssize_t tot_bytes = 0, result = 0;
        long size = MAX_DIO_SIZE;
 
+       /* 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;