[PATCH][SRU][IMPISH] UBUNTU: SAUCE: shiftfs: fix sendfile() invocations

Christian Brauner christian.brauner at ubuntu.com
Mon Aug 9 15:15:28 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1939301

Upstream commit 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
caused a regression for us. It states:

> default_file_splice_write is the last piece of generic code that uses
> set_fs to make the uaccess routines operate on kernel pointers.  It
> implements a "fallback loop" for splicing from files that do not actually
> provide a proper splice_read method.  The usual file systems and other
> high bandwidth instances all provide a ->splice_read, so this just removes
> support for various device drivers and procfs/debugfs files.  If splice
> support for any of those turns out to be important it can be added back
> by switching them to the iter ops and using generic_file_splice_read.

this means that currently all workloads making use of sendfile() on
shiftfs fail. This includes LXD, Anbox and a range of others. Fix this
by providing explicit .splice_read() and .splice_write() methods which
jus restores the status quo and we keep using a generic method provided
by the vfs.

Cc: Seth Forshee <sforshee at kernel.org>
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 fs/shiftfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/shiftfs.c b/fs/shiftfs.c
index abeb7db3b9be..f5f6d8d8144e 100644
--- a/fs/shiftfs.c
+++ b/fs/shiftfs.c
@@ -1737,6 +1737,8 @@ const struct file_operations shiftfs_file_operations = {
 	.compat_ioctl		= shiftfs_compat_ioctl,
 	.copy_file_range	= shiftfs_copy_file_range,
 	.remap_file_range	= shiftfs_remap_file_range,
+	.splice_read		= generic_file_splice_read,
+	.splice_write		= iter_file_splice_write,
 };
 
 const struct file_operations shiftfs_dir_operations = {

base-commit: 81ba95df6435a257ef5ca9fbf4f4f3b7865e16fd
-- 
2.30.2




More information about the kernel-team mailing list