Message ID | 1596715264-3645-1-git-send-email-jiangying8582@126.com |
---|---|
State | Not Applicable |
Headers | show |
Series | [v6] ext4: fix direct I/O read error for kernel stable rc 4.9 | expand |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d8780e0..ccce89d 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3575,6 +3575,11 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) struct address_space *mapping = iocb->ki_filp->f_mapping; struct inode *inode = mapping->host; ssize_t ret; + loff_t offset = iocb->ki_pos; + loff_t size = i_size_read(inode); + + if (offset >= size) + return 0; /* * Shared inode_lock is enough for us - it protects against concurrent