mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
iomap: Fix direct I/O write consistency check
When a direct I/O write falls back to buffered I/O entirely, dio->size will be 0 in iomap_dio_complete. Function invalidate_inode_pages2_range will try to invalidate the rest of the address space. If there are any dirty pages in that range, the write will fail and a "Page cache invalidation failure on direct I/O" error will be logged. On gfs2, this can be reproduced as follows: xfs_io \ -c "open -ft foo" -c "pwrite 4k 4k" -c "close" \ -c "open -d foo" -c "pwrite 0 4k" Fix this by recognizing 0-length writes. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
a805c11165
commit
c114bbc6c4
1 changed files with 1 additions and 1 deletions
|
@ -108,7 +108,7 @@ static ssize_t iomap_dio_complete(struct iomap_dio *dio)
|
||||||
* ->end_io() when necessary, otherwise a racing buffer read would cache
|
* ->end_io() when necessary, otherwise a racing buffer read would cache
|
||||||
* zeros from unwritten extents.
|
* zeros from unwritten extents.
|
||||||
*/
|
*/
|
||||||
if (!dio->error &&
|
if (!dio->error && dio->size &&
|
||||||
(dio->flags & IOMAP_DIO_WRITE) && inode->i_mapping->nrpages) {
|
(dio->flags & IOMAP_DIO_WRITE) && inode->i_mapping->nrpages) {
|
||||||
int err;
|
int err;
|
||||||
err = invalidate_inode_pages2_range(inode->i_mapping,
|
err = invalidate_inode_pages2_range(inode->i_mapping,
|
||||||
|
|
Loading…
Reference in a new issue