diff mbox series

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

Message ID 20210809151528.1307771-1-christian.brauner@ubuntu.com
State New
Headers show
Series [SRU,IMPISH] UBUNTU: SAUCE: shiftfs: fix sendfile() invocations | expand

Commit Message

Christian Brauner Aug. 9, 2021, 3:15 p.m. UTC
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@kernel.org>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 fs/shiftfs.c | 2 ++
 1 file changed, 2 insertions(+)


base-commit: 81ba95df6435a257ef5ca9fbf4f4f3b7865e16fd

Comments

Kleber Sacilotto de Souza Aug. 10, 2021, 1:08 p.m. UTC | #1
On 09.08.21 17:15, Christian Brauner wrote:
> 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@kernel.org>
> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Thanks

> ---
>   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
>
Tim Gardner Aug. 12, 2021, 5:06 p.m. UTC | #2
Acked-by: Tim Gardner <tim.gardner@canonical.com>

On 8/9/21 9:15 AM, Christian Brauner wrote:
> 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@kernel.org>
> Signed-off-by: Christian Brauner <christian.brauner@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
>
Paolo Pisati Aug. 17, 2021, 3:21 p.m. UTC | #3
On Mon, Aug 09, 2021 at 05:15:28PM +0200, Christian Brauner wrote:
> BugLink: https://bugs.launchpad.net/bugs/1939301
diff mbox series

Patch

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 = {