summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-04-24 12:58:22 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-04-24 12:58:22 -0700
commitaee1a009c9d247756b368890e3f886174776d3db (patch)
treec7c2f5fe0f8fe5df2d11e0a7e194db9bbf0028bd /fs
parent81da3d3c1015e1db8b5fa121d4f6f9172d0299f3 (diff)
parent44575a67314b3768d4415252271e8f60c5c70118 (diff)
downloadlinux-aee1a009c9d247756b368890e3f886174776d3db.tar.gz
Merge tag 'io_uring-5.7-2020-04-24' of git://git.kernel.dk/linux-block
Pull io_uring fix from Jens Axboe:
 "Single fixup for a change that went into -rc2"

* tag 'io_uring-5.7-2020-04-24' of git://git.kernel.dk/linux-block:
  io_uring: only restore req->work for req that needs do completion
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 381d50becd04..c687f57fb651 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4200,17 +4200,17 @@ static void io_async_task_func(struct callback_head *cb)
 
 	spin_unlock_irq(&ctx->completion_lock);
 
+	/* restore ->work in case we need to retry again */
+	memcpy(&req->work, &apoll->work, sizeof(req->work));
+
 	if (canceled) {
 		kfree(apoll);
 		io_cqring_ev_posted(ctx);
 		req_set_fail_links(req);
-		io_put_req(req);
+		io_double_put_req(req);
 		return;
 	}
 
-	/* restore ->work in case we need to retry again */
-	memcpy(&req->work, &apoll->work, sizeof(req->work));
-
 	__set_current_state(TASK_RUNNING);
 	mutex_lock(&ctx->uring_lock);
 	__io_queue_sqe(req, NULL);
@@ -4369,7 +4369,7 @@ static bool io_poll_remove_one(struct io_kiocb *req)
 
 	hash_del(&req->hash_node);
 
-	if (apoll) {
+	if (do_complete && apoll) {
 		/*
 		 * restore ->work because we need to call io_req_work_drop_env.
 		 */