Skip to content

Commit f63cf51

Browse files
committed
io_uring: ensure that fsnotify is always called
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@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent abdad70 commit f63cf51

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

fs/io_uring.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2973,8 +2973,12 @@ static bool io_rw_should_reissue(struct io_kiocb *req)
29732973

29742974
static bool __io_complete_rw_common(struct io_kiocb *req, long res)
29752975
{
2976-
if (req->rw.kiocb.ki_flags & IOCB_WRITE)
2976+
if (req->rw.kiocb.ki_flags & IOCB_WRITE) {
29772977
kiocb_end_write(req);
2978+
fsnotify_modify(req->file);
2979+
} else {
2980+
fsnotify_access(req->file);
2981+
}
29782982
if (unlikely(res != req->result)) {
29792983
if ((res == -EAGAIN || res == -EOPNOTSUPP) &&
29802984
io_rw_should_reissue(req)) {
@@ -4537,6 +4541,8 @@ static int io_fallocate(struct io_kiocb *req, unsigned int issue_flags)
45374541
req->sync.len);
45384542
if (ret < 0)
45394543
req_set_fail(req);
4544+
else
4545+
fsnotify_modify(req->file);
45404546
io_req_complete(req, ret);
45414547
return 0;
45424548
}

0 commit comments

Comments
 (0)