All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] splice: report related fsnotify events
@ 2023-03-22  6:25 Chung-Chiang Cheng
  2023-03-22  7:08 ` Amir Goldstein
  2023-04-03 12:31 ` Christian Brauner
  0 siblings, 2 replies; 11+ messages in thread
From: Chung-Chiang Cheng @ 2023-03-22  6:25 UTC (permalink / raw)
  To: viro, linux-fsdevel; +Cc: shepjeng, kernel, Chung-Chiang Cheng

The fsnotify ACCESS and MODIFY event are missing when manipulating a file
with splice(2).

Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
---
 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-04 16:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  6:25 [PATCH] splice: report related fsnotify events Chung-Chiang Cheng
2023-03-22  7:08 ` Amir Goldstein
2023-04-03 17:00   ` Amir Goldstein
2023-04-03 17:03     ` Jens Axboe
2023-04-03 17:15       ` Amir Goldstein
2023-04-03 17:23         ` Jens Axboe
2023-04-04  9:21           ` Jan Kara
2023-04-04 13:45             ` Amir Goldstein
2023-04-04 16:30               ` Jens Axboe
2023-04-04 16:29             ` Jens Axboe
2023-04-03 12:31 ` Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.