diff options
author | Jens Axboe | 2022-03-20 13:08:38 -0600 |
---|---|---|
committer | Jens Axboe | 2022-03-20 17:53:38 -0600 |
commit | f63cf5192fe3418ad5ae1a4412eba5694b145f79 (patch) | |
tree | a352408a142d817237d8f0b63a196b02ef3e5cfc /fs/io_uring.c | |
parent | abdad709ed8fe4fd3b865ed1010de37a49601ff4 (diff) |
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>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 98949348ee02..1a65d7880440 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2973,8 +2973,12 @@ static bool io_rw_should_reissue(struct io_kiocb *req) static bool __io_complete_rw_common(struct io_kiocb *req, long res) { - if (req->rw.kiocb.ki_flags & IOCB_WRITE) + if (req->rw.kiocb.ki_flags & IOCB_WRITE) { kiocb_end_write(req); + fsnotify_modify(req->file); + } else { + fsnotify_access(req->file); + } if (unlikely(res != req->result)) { if ((res == -EAGAIN || res == -EOPNOTSUPP) && io_rw_should_reissue(req)) { @@ -4537,6 +4541,8 @@ static int io_fallocate(struct io_kiocb *req, unsigned int issue_flags) req->sync.len); if (ret < 0) req_set_fail(req); + else + fsnotify_modify(req->file); io_req_complete(req, ret); return 0; } |