From: Chung-Chiang Cheng <cccheng@synology.com>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Cc: shepjeng@gmail.com, kernel@cccheng.net,
Chung-Chiang Cheng <cccheng@synology.com>
Subject: [PATCH] splice: report related fsnotify events
Date: Wed, 22 Mar 2023 14:25:19 +0800 [thread overview]
Message-ID: <20230322062519.409752-1-cccheng@synology.com> (raw)
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
next reply other threads:[~2023-03-22 6:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 6:25 Chung-Chiang Cheng [this message]
2023-03-22 7:08 ` [PATCH] splice: report related fsnotify events 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322062519.409752-1-cccheng@synology.com \
--to=cccheng@synology.com \
--cc=kernel@cccheng.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shepjeng@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).