Skip to content

Commit 1319689

Browse files
Miklos Szeredigregkh
authored andcommitted
fuse: flush extending writes
commit 59bda8e upstream. Callers of fuse_writeback_range() assume that the file is ready for modification by the server in the supplied byte range after the call returns. If there's a write that extends the file beyond the end of the supplied range, then the file needs to be extended to at least the end of the range, but currently that's not done. There are at least two cases where this can cause problems: - copy_file_range() will return short count if the file is not extended up to end of the source range. - FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE will not extend the file, hence the region may not be fully allocated. Fix by flushing writes from the start of the range up to the end of the file. This could be optimized if the writes are non-extending, etc, but it's probably not worth the trouble. Fixes: a2bc923 ("fuse: fix copy_file_range() in the writeback case") Fixes: 6b1bdb5 ("fuse: allow fallocate(FALLOC_FL_ZERO_RANGE)") Cc: <[email protected]> # v5.2 Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8018100 commit 1319689

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3240,7 +3240,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
32403240

32413241
static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end)
32423242
{
3243-
int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
3243+
int err = filemap_write_and_wait_range(inode->i_mapping, start, -1);
32443244

32453245
if (!err)
32463246
fuse_sync_writes(inode);

0 commit comments

Comments
 (0)