io-wq: ensure all pending work is canceled on exit leak
authorJens Axboe <axboe@kernel.dk>
Wed, 3 Mar 2021 22:47:04 +0000 (15:47 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Mar 2021 22:47:04 +0000 (15:47 -0700)
commite64db15019cb6d301a63054db41439c3a626ab02
tree1573ca0454fd0fd190809a4e7f683d3d6d4d3de5
parent4f766d6f773b5b9832e51801116e21b8db2aaead
io-wq: ensure all pending work is canceled on exit

If we race on shutting down the io-wq, then we should ensure that any
work that was queued after workers shutdown is canceled. Harden the
add work check a bit too, checking for IO_WQ_BIT_EXIT and cancel if
it's set.

Add a WARN_ON() for having any work before we kill the io-wq context.

Reported-by: syzbot+91b4b56ead187d35c9d3@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io-wq.c