[PATCH] io_uring: ensure that fsnotify is always called

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>

---

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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux