Skip to content

Commit

Permalink
backing-file: convert to using fops->splice_write
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20240708072208.25244-1-ed.tsai@mediatek.com
Fixes: 5ca7346 ("fuse: implement splice read/write passthrough")
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Ed Tsai authored and Christian Brauner committed Aug 23, 2024
1 parent 232590e commit 996b37d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/backing-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 996b37d

Please sign in to comment.