* [block:for-5.9/io_uring 109/109] fs/io_uring.c:7908:0-1: preceding lock on line 7875
@ 2020-07-25 22:36 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-07-25 22:36 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6779 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Pavel Begunkov <asml.silence@gmail.com>
CC: Jens Axboe <axboe@kernel.dk>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.9/io_uring
head: 4e147a766da5b3209edbc00d686dbf0124591442
commit: 4e147a766da5b3209edbc00d686dbf0124591442 [109/109] io_uring: fix racy req->flags modification
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: alpha-randconfig-c021-20200725 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
coccinelle warnings: (new ones prefixed by >>)
>> fs/io_uring.c:7908:0-1: preceding lock on line 7875
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=4e147a766da5b3209edbc00d686dbf0124591442
git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git remote update block
git checkout 4e147a766da5b3209edbc00d686dbf0124591442
vim +7908 fs/io_uring.c
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7841
fcb323cc53e29d Jens Axboe 2019-10-24 7842 static void io_uring_cancel_files(struct io_ring_ctx *ctx,
fcb323cc53e29d Jens Axboe 2019-10-24 7843 struct files_struct *files)
fcb323cc53e29d Jens Axboe 2019-10-24 7844 {
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7845 if (list_empty_careful(&ctx->inflight_list))
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7846 return;
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7847
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7848 /* cancel all at once, should be faster than doing it one by one*/
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7849 io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true);
67c4d9e693e3bb Pavel Begunkov 2020-06-15 7850
fcb323cc53e29d Jens Axboe 2019-10-24 7851 while (!list_empty_careful(&ctx->inflight_list)) {
d8f1b9716cfd1a Xiaoguang Wang 2020-04-26 7852 struct io_kiocb *cancel_req = NULL, *req;
d8f1b9716cfd1a Xiaoguang Wang 2020-04-26 7853 DEFINE_WAIT(wait);
fcb323cc53e29d Jens Axboe 2019-10-24 7854
fcb323cc53e29d Jens Axboe 2019-10-24 7855 spin_lock_irq(&ctx->inflight_lock);
fcb323cc53e29d Jens Axboe 2019-10-24 7856 list_for_each_entry(req, &ctx->inflight_list, inflight_entry) {
768134d4f48109 Jens Axboe 2019-11-10 7857 if (req->work.files != files)
768134d4f48109 Jens Axboe 2019-11-10 7858 continue;
768134d4f48109 Jens Axboe 2019-11-10 7859 /* req is being completed, ignore */
768134d4f48109 Jens Axboe 2019-11-10 7860 if (!refcount_inc_not_zero(&req->refs))
768134d4f48109 Jens Axboe 2019-11-10 7861 continue;
768134d4f48109 Jens Axboe 2019-11-10 7862 cancel_req = req;
fcb323cc53e29d Jens Axboe 2019-10-24 7863 break;
fcb323cc53e29d Jens Axboe 2019-10-24 7864 }
768134d4f48109 Jens Axboe 2019-11-10 7865 if (cancel_req)
fcb323cc53e29d Jens Axboe 2019-10-24 7866 prepare_to_wait(&ctx->inflight_wait, &wait,
fcb323cc53e29d Jens Axboe 2019-10-24 7867 TASK_UNINTERRUPTIBLE);
fcb323cc53e29d Jens Axboe 2019-10-24 7868 spin_unlock_irq(&ctx->inflight_lock);
fcb323cc53e29d Jens Axboe 2019-10-24 7869
768134d4f48109 Jens Axboe 2019-11-10 7870 /* We need to keep going until we don't find a matching req */
768134d4f48109 Jens Axboe 2019-11-10 7871 if (!cancel_req)
fcb323cc53e29d Jens Axboe 2019-10-24 7872 break;
2f6d9b9d6357ed Bob Liu 2019-11-13 7873
2ca10259b4189a Jens Axboe 2020-02-13 7874 if (cancel_req->flags & REQ_F_OVERFLOW) {
2ca10259b4189a Jens Axboe 2020-02-13 @7875 spin_lock_irq(&ctx->completion_lock);
4e147a766da5b3 Pavel Begunkov 2020-07-25 7876
4e147a766da5b3 Pavel Begunkov 2020-07-25 7877 if (list_empty(&cancel_req->compl.list))
4e147a766da5b3 Pavel Begunkov 2020-07-25 7878 goto out_wait;
4e147a766da5b3 Pavel Begunkov 2020-07-25 7879 list_del_init(&cancel_req->compl.list);
4e147a766da5b3 Pavel Begunkov 2020-07-25 7880
2ca10259b4189a Jens Axboe 2020-02-13 7881 if (list_empty(&ctx->cq_overflow_list)) {
2ca10259b4189a Jens Axboe 2020-02-13 7882 clear_bit(0, &ctx->sq_check_overflow);
2ca10259b4189a Jens Axboe 2020-02-13 7883 clear_bit(0, &ctx->cq_check_overflow);
6d5f904904608a Xiaoguang Wang 2020-07-09 7884 ctx->rings->sq_flags &= ~IORING_SQ_CQ_OVERFLOW;
2ca10259b4189a Jens Axboe 2020-02-13 7885 }
2ca10259b4189a Jens Axboe 2020-02-13 7886 spin_unlock_irq(&ctx->completion_lock);
2ca10259b4189a Jens Axboe 2020-02-13 7887
2ca10259b4189a Jens Axboe 2020-02-13 7888 WRITE_ONCE(ctx->rings->cq_overflow,
2ca10259b4189a Jens Axboe 2020-02-13 7889 atomic_inc_return(&ctx->cached_cq_overflow));
2ca10259b4189a Jens Axboe 2020-02-13 7890
2ca10259b4189a Jens Axboe 2020-02-13 7891 /*
2ca10259b4189a Jens Axboe 2020-02-13 7892 * Put inflight ref and overflow ref. If that's
2ca10259b4189a Jens Axboe 2020-02-13 7893 * all we had, then we're done with this request.
2ca10259b4189a Jens Axboe 2020-02-13 7894 */
2ca10259b4189a Jens Axboe 2020-02-13 7895 if (refcount_sub_and_test(2, &cancel_req->refs)) {
4518a3cc273cf8 Pavel Begunkov 2020-05-26 7896 io_free_req(cancel_req);
d8f1b9716cfd1a Xiaoguang Wang 2020-04-26 7897 finish_wait(&ctx->inflight_wait, &wait);
2ca10259b4189a Jens Axboe 2020-02-13 7898 continue;
2ca10259b4189a Jens Axboe 2020-02-13 7899 }
7b53d59859bc93 Pavel Begunkov 2020-05-30 7900 } else {
2f6d9b9d6357ed Bob Liu 2019-11-13 7901 io_wq_cancel_work(ctx->io_wq, &cancel_req->work);
2f6d9b9d6357ed Bob Liu 2019-11-13 7902 io_put_req(cancel_req);
7b53d59859bc93 Pavel Begunkov 2020-05-30 7903 }
4e147a766da5b3 Pavel Begunkov 2020-07-25 7904 out_wait:
fcb323cc53e29d Jens Axboe 2019-10-24 7905 schedule();
768134d4f48109 Jens Axboe 2019-11-10 7906 finish_wait(&ctx->inflight_wait, &wait);
fcb323cc53e29d Jens Axboe 2019-10-24 7907 }
d8f1b9716cfd1a Xiaoguang Wang 2020-04-26 @7908 }
fcb323cc53e29d Jens Axboe 2019-10-24 7909
:::::: The code at line 7908 was first introduced by commit
:::::: d8f1b9716cfd1a1f74c0fedad40c5f65a25aa208 io_uring: fix mismatched finish_wait() calls in io_uring_cancel_files()
:::::: TO: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
:::::: CC: Jens Axboe <axboe@kernel.dk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28962 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-25 22:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 22:36 [block:for-5.9/io_uring 109/109] fs/io_uring.c:7908:0-1: preceding lock on line 7875 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.