public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: ensure that fsnotify is always called
@ 2022-03-20 19:12 Jens Axboe
  2022-03-20 19:43 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2022-03-20 19:12 UTC (permalink / raw)
  To: io-uring

Ensure that we call fsnotify_modify() if we write a file, and that we
do fsnotify_access() if we read it. This enables anyone using inotify
on the file to get notified.

Ditto for fallocate, ensure that fsnotify_modify() is called.

Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 98949348ee02..7492f842025a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2922,6 +2922,7 @@ static void kiocb_end_write(struct io_kiocb *req)
 		__sb_writers_acquired(sb, SB_FREEZE_WRITE);
 		sb_end_write(sb);
 	}
+	fsnotify_modify(req->file);
 }
 
 #ifdef CONFIG_BLOCK
@@ -2975,6 +2976,8 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)
 {
 	if (req->rw.kiocb.ki_flags & IOCB_WRITE)
 		kiocb_end_write(req);
+	else
+		fsnotify_access(req->file);
 	if (unlikely(res != req->result)) {
 		if ((res == -EAGAIN || res == -EOPNOTSUPP) &&
 		    io_rw_should_reissue(req)) {
@@ -4538,6 +4541,7 @@ static int io_fallocate(struct io_kiocb *req, unsigned int issue_flags)
 	if (ret < 0)
 		req_set_fail(req);
 	io_req_complete(req, ret);
+	fsnotify_modify(req->file);
 	return 0;
 }
 
-- 
Jens Axboe


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

end of thread, other threads:[~2022-03-20 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-20 19:12 [PATCH] io_uring: ensure that fsnotify is always called Jens Axboe
2022-03-20 19:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox