Skip to content

Commit

Permalink
splice: report related fsnotify events
Browse files Browse the repository at this point in the history
The fsnotify ACCESS and MODIFY event are missing when manipulating a file
with splice(2).

Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Message-Id: <20230322062519.409752-1-cccheng@synology.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Chung-Chiang Cheng authored and Christian Brauner committed Apr 4, 2023
1 parent 364595a commit 983652c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/export.h>
#include <linux/syscalls.h>
#include <linux/uio.h>
#include <linux/fsnotify.h>
#include <linux/security.h>
#include <linux/gfp.h>
#include <linux/socket.h>
Expand Down Expand Up @@ -1165,6 +1166,9 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
ret = do_splice_from(ipipe, out, &offset, len, flags);
file_end_write(out);

if (ret > 0)
fsnotify_modify(out);

if (!off_out)
out->f_pos = offset;
else
Expand All @@ -1188,6 +1192,10 @@ long do_splice(struct file *in, loff_t *off_in, struct file *out,
flags |= SPLICE_F_NONBLOCK;

ret = splice_file_to_pipe(in, opipe, &offset, len, flags);

if (ret > 0)
fsnotify_access(in);

if (!off_in)
in->f_pos = offset;
else
Expand Down

0 comments on commit 983652c

Please sign in to comment.