* [PATCH 1/1] backing-file: convert to using fops->splice_write
@ 2024-07-08 7:22 ed.tsai
2024-08-23 9:19 ` Amir Goldstein
2024-08-23 11:09 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: ed.tsai @ 2024-07-08 7:22 UTC (permalink / raw)
To: Matthew Wilcox, Miklos Szeredi, Amir Goldstein, Alexander Viro,
Christian Brauner, Jan Kara, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: chun-hung.wu, Ed Tsai, linux-fsdevel, linux-unionfs, linux-kernel,
linux-arm-kernel, linux-mediatek
From: Ed Tsai <ed.tsai@mediatek.com>
Filesystems may define their own splice write. Therefore, use the file
fops instead of invoking iter_file_splice_write() directly.
Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
---
fs/backing-file.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/backing-file.c b/fs/backing-file.c
index afb557446c27..8860dac58c37 100644
--- a/fs/backing-file.c
+++ b/fs/backing-file.c
@@ -303,13 +303,16 @@ ssize_t backing_file_splice_write(struct pipe_inode_info *pipe,
if (WARN_ON_ONCE(!(out->f_mode & FMODE_BACKING)))
return -EIO;
+ if (!out->f_op->splice_write)
+ return -EINVAL;
+
ret = file_remove_privs(ctx->user_file);
if (ret)
return ret;
old_cred = override_creds(ctx->cred);
file_start_write(out);
- ret = iter_file_splice_write(pipe, out, ppos, len, flags);
+ ret = out->f_op->splice_write(pipe, out, ppos, len, flags);
file_end_write(out);
revert_creds(old_cred);
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] backing-file: convert to using fops->splice_write
2024-07-08 7:22 [PATCH 1/1] backing-file: convert to using fops->splice_write ed.tsai
@ 2024-08-23 9:19 ` Amir Goldstein
2024-08-23 11:09 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Amir Goldstein @ 2024-08-23 9:19 UTC (permalink / raw)
To: ed.tsai, Christian Brauner
Cc: Matthew Wilcox, Miklos Szeredi, Alexander Viro, Jan Kara,
Matthias Brugger, AngeloGioacchino Del Regno, chun-hung.wu,
linux-fsdevel, linux-unionfs, linux-kernel, linux-arm-kernel,
linux-mediatek
Christian,
Would you mind picking up this fix via the vfs tree?
The reason that the Fixes tag points to fuse passthrough patch is twofold:
1. fuse passthrough is a new user of backing_file_splice_write() which
can have a fuse or overlayfs backing file with custom ->splice_write()
2. overlayfs can have a backing upper file which is a fuse passthrough
file with a custom ->splice_write()
Thanks,
Amir.
On Mon, Jul 8, 2024 at 9:23 AM <ed.tsai@mediatek.com> wrote:
>
> From: Ed Tsai <ed.tsai@mediatek.com>
>
> Filesystems may define their own splice write. Therefore, use the file
> fops instead of invoking iter_file_splice_write() directly.
>
Fixes: 5ca73468612d ("fuse: implement splice read/write passthrough")
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Ed Tsai <ed.tsai@mediatek.com>
> ---
> fs/backing-file.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/backing-file.c b/fs/backing-file.c
> index afb557446c27..8860dac58c37 100644
> --- a/fs/backing-file.c
> +++ b/fs/backing-file.c
> @@ -303,13 +303,16 @@ ssize_t backing_file_splice_write(struct pipe_inode_info *pipe,
> if (WARN_ON_ONCE(!(out->f_mode & FMODE_BACKING)))
> return -EIO;
>
> + if (!out->f_op->splice_write)
> + return -EINVAL;
> +
> ret = file_remove_privs(ctx->user_file);
> if (ret)
> return ret;
>
> old_cred = override_creds(ctx->cred);
> file_start_write(out);
> - ret = iter_file_splice_write(pipe, out, ppos, len, flags);
> + ret = out->f_op->splice_write(pipe, out, ppos, len, flags);
> file_end_write(out);
> revert_creds(old_cred);
>
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] backing-file: convert to using fops->splice_write
2024-07-08 7:22 [PATCH 1/1] backing-file: convert to using fops->splice_write ed.tsai
2024-08-23 9:19 ` Amir Goldstein
@ 2024-08-23 11:09 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-08-23 11:09 UTC (permalink / raw)
To: Amir Goldstein, ed.tsai
Cc: Christian Brauner, chun-hung.wu, linux-fsdevel, linux-unionfs,
linux-kernel, linux-arm-kernel, linux-mediatek, Matthew Wilcox,
Miklos Szeredi, Alexander Viro, Jan Kara, Matthias Brugger,
AngeloGioacchino Del Regno
On Mon, 08 Jul 2024 15:22:06 +0800, ed.tsai@mediatek.com wrote:
> Filesystems may define their own splice write. Therefore, use the file
> fops instead of invoking iter_file_splice_write() directly.
>
>
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] backing-file: convert to using fops->splice_write
https://git.kernel.org/vfs/vfs/c/996b37da1e0f
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-23 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 7:22 [PATCH 1/1] backing-file: convert to using fops->splice_write ed.tsai
2024-08-23 9:19 ` Amir Goldstein
2024-08-23 11:09 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox