mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
fuse: fall back to copy_splice_read() on FOPEN_DIRECT_IO
Yafang Shao reports:
"After upgrading the kernel from 6.1.y to 6.18.y on production servers,
some containers failed to read lxcfs data. The root cause is that our
lxcfs is still at the old v3.0.4, which does not include commit 25982f5
("Set the file size to 4k") [0].
Between 6.1.y and 6.18.y, the FUSE splice_read path was converted from
generic_file_splice_read() to filemap_splice_read() by commit
2cb1e08985 ("splice: Use filemap_splice_read() instead of
generic_file_splice_read()"). Unlike generic_file_splice_read(),
filemap_splice_read() strictly checks i_size and refuses to read from
zero-size files, which breaks virtual FUSE filesystems like the old
lxcfs."
Fix by using copy_splice_read() for the FOPEN_DIRECT_IO case, just like the
VFS does for DAX and O_DIRECT files.
Reported-by: Yafang Shao <laoar.shao@gmail.com>
Closes: https://lore.kernel.org/all/20260706025705.58301-1-laoar.shao@gmail.com/
Reported-by: Changyuan Lyu <changyuanl@google.com>
Closes: https://lore.kernel.org/all/20260901213412.1763253-1-changyuanl@google.com/
Fixes: 2cb1e08985 ("splice: Use filemap_splice_read() instead of generic_file_splice_read()")
Tested-and-acked-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
fc60668db8
commit
10bd6b3296
|
|
@ -1876,7 +1876,10 @@ static ssize_t fuse_splice_read(struct file *in, loff_t *ppos,
|
|||
struct fuse_file *ff = in->private_data;
|
||||
|
||||
/* FOPEN_DIRECT_IO overrides FOPEN_PASSTHROUGH */
|
||||
if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO))
|
||||
|
||||
if (ff->open_flags & FOPEN_DIRECT_IO)
|
||||
return copy_splice_read(in, ppos, pipe, len, flags);
|
||||
else if (fuse_file_passthrough(ff))
|
||||
return fuse_passthrough_splice_read(in, ppos, pipe, len, flags);
|
||||
else
|
||||
return filemap_splice_read(in, ppos, pipe, len, flags);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user