linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jffs2: Hook up splice_write callback
@ 2021-03-30 13:45 Joel Stanley
  2021-03-30 16:17 ` Christoph Hellwig
  2021-03-31  4:55 ` Lei YU
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Stanley @ 2021-03-30 13:45 UTC (permalink / raw)
  To: David Woodhouse, Richard Weinberger, Al Viro, Kees Cook,
	Christoph Hellwig
  Cc: William A . Kennington III, Lei YU, linux-mtd, linux-kernel

overlayfs using jffs2 as the upper filesystem would fail in some cases
since moving to v5.10. The test case used was to run 'touch' on a file
that exists in the lower fs, causing the modification time to be
updated. It returns EINVAL when the bug is triggered.

A bisection showed this was introduced in v5.9-rc1, with commit
36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
Reverting that commit restores the expected behaviour.

Some digging showed that this was due to jffs2 lacking an implementation
of splice_write. (For unknown reasons the warn_unsupported that should
trigger was not displaying any output).

Adding this patch resolved the issue and the test now passes.

Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 fs/jffs2/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index f8fb89b10227..4fc8cd698d1a 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -57,6 +57,7 @@ const struct file_operations jffs2_file_operations =
 	.mmap =		generic_file_readonly_mmap,
 	.fsync =	jffs2_fsync,
 	.splice_read =	generic_file_splice_read,
+	.splice_write = iter_file_splice_write,
 };
 
 /* jffs2_file_inode_operations */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] jffs2: Hook up splice_write callback
  2021-03-30 13:45 [PATCH] jffs2: Hook up splice_write callback Joel Stanley
@ 2021-03-30 16:17 ` Christoph Hellwig
  2021-03-30 18:31   ` Al Viro
  2021-03-31  4:55 ` Lei YU
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2021-03-30 16:17 UTC (permalink / raw)
  To: Joel Stanley
  Cc: David Woodhouse, Richard Weinberger, Al Viro, Kees Cook,
	Christoph Hellwig, William A . Kennington III, Lei YU, linux-mtd,
	linux-kernel

On Wed, Mar 31, 2021 at 12:15:37AM +1030, Joel Stanley wrote:
> overlayfs using jffs2 as the upper filesystem would fail in some cases
> since moving to v5.10. The test case used was to run 'touch' on a file
> that exists in the lower fs, causing the modification time to be
> updated. It returns EINVAL when the bug is triggered.
> 
> A bisection showed this was introduced in v5.9-rc1, with commit
> 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
> Reverting that commit restores the expected behaviour.
> 
> Some digging showed that this was due to jffs2 lacking an implementation
> of splice_write. (For unknown reasons the warn_unsupported that should
> trigger was not displaying any output).
> 
> Adding this patch resolved the issue and the test now passes.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] jffs2: Hook up splice_write callback
  2021-03-30 16:17 ` Christoph Hellwig
@ 2021-03-30 18:31   ` Al Viro
  2021-03-30 18:38     ` Al Viro
  2021-03-31 14:44     ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Al Viro @ 2021-03-30 18:31 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joel Stanley, David Woodhouse, Richard Weinberger, Kees Cook,
	William A . Kennington III, Lei YU, linux-mtd, linux-kernel

On Tue, Mar 30, 2021 at 06:17:15PM +0200, Christoph Hellwig wrote:
> On Wed, Mar 31, 2021 at 12:15:37AM +1030, Joel Stanley wrote:
> > overlayfs using jffs2 as the upper filesystem would fail in some cases
> > since moving to v5.10. The test case used was to run 'touch' on a file
> > that exists in the lower fs, causing the modification time to be
> > updated. It returns EINVAL when the bug is triggered.
> > 
> > A bisection showed this was introduced in v5.9-rc1, with commit
> > 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
> > Reverting that commit restores the expected behaviour.
> > 
> > Some digging showed that this was due to jffs2 lacking an implementation
> > of splice_write. (For unknown reasons the warn_unsupported that should
> > trigger was not displaying any output).
> > 
> > Adding this patch resolved the issue and the test now passes.
> 
> Looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

The same goes for quite a few other filesystems, actually - at least
adfs, affs, bfs, hfs, hfsplus, hostfs, hpfs, minix, omfs, sysv, ufs 
and vboxsf are in the same boat, and I suspect that ecryptfs and ntfs
might be too.

Christoph, do you see any problems with doing the same thing for that
bunch as well?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] jffs2: Hook up splice_write callback
  2021-03-30 18:31   ` Al Viro
@ 2021-03-30 18:38     ` Al Viro
  2021-03-31 14:44     ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Al Viro @ 2021-03-30 18:38 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Joel Stanley, David Woodhouse, Richard Weinberger, Kees Cook,
	William A . Kennington III, Lei YU, linux-mtd, linux-kernel

On Tue, Mar 30, 2021 at 06:31:00PM +0000, Al Viro wrote:
> On Tue, Mar 30, 2021 at 06:17:15PM +0200, Christoph Hellwig wrote:
> > On Wed, Mar 31, 2021 at 12:15:37AM +1030, Joel Stanley wrote:
> > > overlayfs using jffs2 as the upper filesystem would fail in some cases
> > > since moving to v5.10. The test case used was to run 'touch' on a file
> > > that exists in the lower fs, causing the modification time to be
> > > updated. It returns EINVAL when the bug is triggered.
> > > 
> > > A bisection showed this was introduced in v5.9-rc1, with commit
> > > 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
> > > Reverting that commit restores the expected behaviour.
> > > 
> > > Some digging showed that this was due to jffs2 lacking an implementation
> > > of splice_write. (For unknown reasons the warn_unsupported that should
> > > trigger was not displaying any output).
> > > 
> > > Adding this patch resolved the issue and the test now passes.
> > 
> > Looks good:
> > 
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> The same goes for quite a few other filesystems, actually - at least
> adfs, affs, bfs, hfs, hfsplus, hostfs, hpfs, minix, omfs, sysv, ufs 
> and vboxsf are in the same boat, and I suspect that ecryptfs and ntfs
> might be too.
> 
> Christoph, do you see any problems with doing the same thing for that
> bunch as well?

coda and udf as well, by the look of it...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] jffs2: Hook up splice_write callback
  2021-03-30 13:45 [PATCH] jffs2: Hook up splice_write callback Joel Stanley
  2021-03-30 16:17 ` Christoph Hellwig
@ 2021-03-31  4:55 ` Lei YU
  1 sibling, 0 replies; 6+ messages in thread
From: Lei YU @ 2021-03-31  4:55 UTC (permalink / raw)
  To: Joel Stanley
  Cc: David Woodhouse, Richard Weinberger, Al Viro, Kees Cook,
	Christoph Hellwig, William A . Kennington III, linux-mtd,
	Linux Kernel Mailing List

On Tue, Mar 30, 2021 at 9:45 PM Joel Stanley <joel@jms.id.au> wrote:
>
> overlayfs using jffs2 as the upper filesystem would fail in some cases
> since moving to v5.10. The test case used was to run 'touch' on a file
> that exists in the lower fs, causing the modification time to be
> updated. It returns EINVAL when the bug is triggered.
>
> A bisection showed this was introduced in v5.9-rc1, with commit
> 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops").
> Reverting that commit restores the expected behaviour.
>
> Some digging showed that this was due to jffs2 lacking an implementation
> of splice_write. (For unknown reasons the warn_unsupported that should
> trigger was not displaying any output).
>
> Adding this patch resolved the issue and the test now passes.
>
> Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  fs/jffs2/file.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
> index f8fb89b10227..4fc8cd698d1a 100644
> --- a/fs/jffs2/file.c
> +++ b/fs/jffs2/file.c
> @@ -57,6 +57,7 @@ const struct file_operations jffs2_file_operations =
>         .mmap =         generic_file_readonly_mmap,
>         .fsync =        jffs2_fsync,
>         .splice_read =  generic_file_splice_read,
> +       .splice_write = iter_file_splice_write,
>  };
>
>  /* jffs2_file_inode_operations */
> --
> 2.30.2
>

Verified on g220a openbmc system that the patch fixes the issue.

Tested-by: Lei YU <yulei.sh@bytedance.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] jffs2: Hook up splice_write callback
  2021-03-30 18:31   ` Al Viro
  2021-03-30 18:38     ` Al Viro
@ 2021-03-31 14:44     ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-03-31 14:44 UTC (permalink / raw)
  To: Al Viro
  Cc: Christoph Hellwig, Joel Stanley, David Woodhouse,
	Richard Weinberger, Kees Cook, William A . Kennington III,
	Lei YU, linux-mtd, linux-kernel

On Tue, Mar 30, 2021 at 06:31:00PM +0000, Al Viro wrote:
> The same goes for quite a few other filesystems, actually - at least
> adfs, affs, bfs, hfs, hfsplus, hostfs, hpfs, minix, omfs, sysv, ufs 
> and vboxsf are in the same boat, and I suspect that ecryptfs and ntfs
> might be too.
> 
> Christoph, do you see any problems with doing the same thing for that
> bunch as well?

Linus asked to only fix things up where we get reports, but I think his
intent there was more random procfs and debugfs files rather than file
systems.  So just doing the sweep should be fine.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-31 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 13:45 [PATCH] jffs2: Hook up splice_write callback Joel Stanley
2021-03-30 16:17 ` Christoph Hellwig
2021-03-30 18:31   ` Al Viro
2021-03-30 18:38     ` Al Viro
2021-03-31 14:44     ` Christoph Hellwig
2021-03-31  4:55 ` Lei YU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).