From 983652c691990b3257a07f67f4263eb847baa82d Mon Sep 17 00:00:00 2001 From: Chung-Chiang Cheng Date: Wed, 22 Mar 2023 14:25:19 +0800 Subject: splice: report related fsnotify events The fsnotify ACCESS and MODIFY event are missing when manipulating a file with splice(2). Signed-off-by: Chung-Chiang Cheng Reviewed-by: Amir Goldstein Acked-by: Jan Kara Message-Id: <20230322062519.409752-1-cccheng@synology.com> Signed-off-by: Christian Brauner --- fs/splice.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fs/splice.c') diff --git a/fs/splice.c b/fs/splice.c index 2c3dec2b6dfa..0af8d150394f 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -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 @@ -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 -- cgit