Skip to content

Commit 8510edf

Browse files
lostjefflebrauner
authored andcommitted
mm/filemap: fix miscalculated file range for filemap_fdatawrite_range_kick()
iocb->ki_pos has been updated with the number of written bytes since generic_perform_write(). Besides __filemap_fdatawrite_range() accepts the inclusive end of the data range. Fixes: 1d44575 ("mm: call filemap_fdatawrite_range_kick() after IOCB_DONTCACHE issue") Signed-off-by: Jingbo Xu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent b4c173d commit 8510edf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/linux/fs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,8 +2975,8 @@ static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count)
29752975
} else if (iocb->ki_flags & IOCB_DONTCACHE) {
29762976
struct address_space *mapping = iocb->ki_filp->f_mapping;
29772977

2978-
filemap_fdatawrite_range_kick(mapping, iocb->ki_pos,
2979-
iocb->ki_pos + count);
2978+
filemap_fdatawrite_range_kick(mapping, iocb->ki_pos - count,
2979+
iocb->ki_pos - 1);
29802980
}
29812981

29822982
return count;

mm/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ EXPORT_SYMBOL(filemap_fdatawrite_range);
445445
* filemap_fdatawrite_range_kick - start writeback on a range
446446
* @mapping: target address_space
447447
* @start: index to start writeback on
448-
* @end: last (non-inclusive) index for writeback
448+
* @end: last (inclusive) index for writeback
449449
*
450450
* This is a non-integrity writeback helper, to start writing back folios
451451
* for the indicated range.

0 commit comments

Comments
 (0)