OSDN Git Service

io_uring: only flush workqueues on fileset removal
authorJens Axboe <axboe@kernel.dk>
Wed, 9 Oct 2019 20:40:13 +0000 (14:40 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Oct 2019 21:13:47 +0000 (15:13 -0600)
We should not remove the workqueue, we just need to ensure that the
workqueues are synced. The workqueues are torn down on ctx removal.

Cc: stable@vger.kernel.org
Fixes: 6b06314c47e1 ("io_uring: add file set registration")
Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index ceb3497..2c44648 100644 (file)
@@ -2866,8 +2866,12 @@ static void io_finish_async(struct io_ring_ctx *ctx)
 static void io_destruct_skb(struct sk_buff *skb)
 {
        struct io_ring_ctx *ctx = skb->sk->sk_user_data;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(ctx->sqo_wq); i++)
+               if (ctx->sqo_wq[i])
+                       flush_workqueue(ctx->sqo_wq[i]);
 
-       io_finish_async(ctx);
        unix_destruct_scm(skb);
 }