mm/filemap: pass inclusive 'end_byte' parameter to filemap_range_has_page
authorzhengbin <[email protected]>
Tue, 5 Mar 2019 23:44:21 +0000 (15:44 -0800)
committerLinus Torvalds <[email protected]>
Wed, 6 Mar 2019 05:07:16 +0000 (21:07 -0800)
The 'end_byte' parameter of filemap_range_has_page is required to be
inclusive, so follow the rule.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 6be96d3ad34a ("fs: return if direct I/O will trigger writeback")
Signed-off-by: zhengbin <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Reviewed-by: Matthew Wilcox <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Cc: Amir Goldstein <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Hou Tao <[email protected]>
Cc: zhangyi (F) <[email protected]>
Cc: Jan Kara <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/filemap.c

index 935fbc29aeb13a5f282133630e71340d58a97485..e59fdecdab74f3b487d1b3526d1e52f793420551 100644 (file)
@@ -3071,7 +3071,7 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
        if (iocb->ki_flags & IOCB_NOWAIT) {
                /* If there are pages to writeback, return */
                if (filemap_range_has_page(inode->i_mapping, pos,
-                                          pos + write_len))
+                                          pos + write_len - 1))
                        return -EAGAIN;
        } else {
                written = filemap_write_and_wait_range(mapping, pos,