diff mbox series

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

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

Commit Message

Christian Brauner Aug. 9, 2021, 3:14 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: 7b737a8f4500b183bbaffd28a879a6d344ab4741

Comments

Stefan Bader Aug. 10, 2021, 9:47 a.m. UTC | #1
On 09.08.21 17:14, 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: Stefan Bader <stefan.bader@canonical.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: 7b737a8f4500b183bbaffd28a879a6d344ab4741
>
Kleber Sacilotto de Souza Aug. 10, 2021, 10 a.m. UTC | #2
On 09.08.21 17:14, 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: 7b737a8f4500b183bbaffd28a879a6d344ab4741
>
Kleber Sacilotto de Souza Aug. 11, 2021, 1:45 p.m. UTC | #3
On 09.08.21 17:14, 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: 7b737a8f4500b183bbaffd28a879a6d344ab4741
> 

Applied to hirsute:linux.

Thanks,
Kleber
Christian Brauner Aug. 11, 2021, 2:01 p.m. UTC | #4
On Wed, Aug 11, 2021 at 03:45:52PM +0200, Kleber Souza wrote:
> On 09.08.21 17:14, 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: 7b737a8f4500b183bbaffd28a879a6d344ab4741
> > 
> 
> Applied to hirsute:linux.

Thank you!
Christian
Andrea Righi Aug. 17, 2021, 6:56 a.m. UTC | #5
On Mon, Aug 09, 2021 at 05:14:47PM +0200, 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: 7b737a8f4500b183bbaffd28a879a6d344ab4741

Applied also to impish:linux.

Thanks!
-Andrea
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 = {