diff options
| author | Jens Axboe <axboe@kernel.dk> | 2026-09-08 17:53:20 -0600 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-09-08 19:03:26 -0600 |
| commit | 796aa0547557e63338657ed1c487906f9fac4c73 (patch) | |
| tree | b207b3db457276344dca45b4ad7f91c479c39ee5 /scripts/Makefile.thinlto | |
| parent | 2cf20c4e0f72d523b8673053e7120d092ff1f074 (diff) | |
| download | linux-796aa0547557e63338657ed1c487906f9fac4c73.tar.gz linux-796aa0547557e63338657ed1c487906f9fac4c73.zip | |
io_uring/rw: end write accounting from ->ki_complete
Commit b000145e9907 moved both the fsnotify calls and the write
accounting out of the kiocb completion handler and into the
io_req_rw_complete() task_work. However, only the fsnotify part actually
needed to move as it may sleep. Ending the write accounting is just a
percpu_up_read() on the superblock writers sem.
Deferring it is a problem, because it makes dropping SB_FREEZE_WRITE
protection depend on the ring owner getting to running task_work. But
the task may be blocked in freeze_super(), causing it to never get to
that:
task io-wq worker
--------------------------------------------------------------
io_write()
io_kiocb_start_write() (takes sb_writers, hidden from
lockdep by __sb_writers_release)
write_iter() -> -EIOCBQUEUED
ioctl(FS_IOC_SHUTDOWN)
bdev_freeze()
freeze_super()
percpu_down_write() <- waits for the reader above
io_write()
kiocb_start_write()
percpu_down_read() <- queued
behind the
writer
<bio completes>
io_complete_rw()
queues io_req_rw_complete() <- never runs, task is in D state
End the write from io_complete_rw() instead, and leave only the fsnotify
calls in task_work.
Reported-by: syzbot+2eb3d983669d3e49d4fa@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
Fixes: b000145e9907 ("io_uring/rw: defer fsnotify calls to task context")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
