public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: io-uring <[email protected]>
Subject: [PATCH] io_uring: ensure that fsnotify is always called
Date: Sun, 20 Mar 2022 13:12:24 -0600	[thread overview]
Message-ID: <[email protected]> (raw)

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


             reply	other threads:[~2022-03-20 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20 19:12 Jens Axboe [this message]
2022-03-20 19:43 ` [PATCH] io_uring: ensure that fsnotify is always called Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    /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