linux-stable/fs/fuse
Miklos Szeredi 1319689981 fuse: flush extending writes
commit 59bda8ecee 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: a2bc923629 ("fuse: fix copy_file_range() in the writeback case")
Fixes: 6b1bdb56b1 ("fuse: allow fallocate(FALLOC_FL_ZERO_RANGE)")
Cc: <stable@vger.kernel.org>  # v5.2
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-15 09:50:48 +02:00
..
acl.c fuse: fix bad inode 2021-01-09 13:46:24 +01:00
control.c fuse: split fuse_mount off of fuse_conn 2020-09-18 15:17:41 +02:00
cuse.c cuse: prevent clone 2021-05-19 10:12:56 +02:00
dax.c fuse: split fuse_mount off of fuse_conn 2020-09-18 15:17:41 +02:00
dev.c fuse: reject internal errno 2021-07-14 16:55:47 +02:00
dir.c fuse: fix illegal access to inode with reused nodeid 2021-09-08 08:49:02 +02:00
file.c fuse: flush extending writes 2021-09-15 09:50:48 +02:00
fuse_i.h fuse: fix illegal access to inode with reused nodeid 2021-09-08 08:49:02 +02:00
inode.c fuse: fix illegal access to inode with reused nodeid 2021-09-08 08:49:02 +02:00
Kconfig virtiofs: implement dax read/write operations 2020-09-10 11:39:23 +02:00
Makefile virtiofs: add a mount option to enable dax 2020-09-10 11:39:22 +02:00
readdir.c fuse: fix illegal access to inode with reused nodeid 2021-09-08 08:49:02 +02:00
virtio_fs.c virtiofs: fix userns 2021-05-19 10:12:56 +02:00
xattr.c fuse: fix bad inode 2021-01-09 13:46:24 +01:00