On Wed, Mar 22, 2023 at 8:51 AM Chung-Chiang Cheng <cccheng@xxxxxxxxxxxx> wrote: > > The fsnotify ACCESS and MODIFY event are missing when manipulating a file > with splice(2). > > Signed-off-by: Chung-Chiang Cheng <cccheng@xxxxxxxxxxxx> Looks good. Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- > fs/splice.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/splice.c b/fs/splice.c > index 5969b7a1d353..9cadcaf52a3e 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -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> > @@ -1074,6 +1075,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 > @@ -1097,6 +1101,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 > -- > 2.34.1 >