Patch "io_uring: return cancelation status from poll/timeout/files handlers" has been added to the 5.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    io_uring: return cancelation status from poll/timeout/files handlers

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     io_uring-return-cancelation-status-from-poll-timeout-files-handlers.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Thu Oct 29 01:16:54 PM CET 2020
From: Jens Axboe <axboe@xxxxxxxxx>
Date: Sat, 26 Sep 2020 15:05:03 -0600
Subject: io_uring: return cancelation status from poll/timeout/files handlers

From: Jens Axboe <axboe@xxxxxxxxx>

commit 76e1b6427fd8246376a97e3227049d49188dfb9c upstream.

Return whether we found and canceled requests or not. This is in
preparation for using this information, no functional changes in this
patch.

Reviewed-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/io_uring.c |   30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1143,15 +1143,23 @@ static bool io_task_match(struct io_kioc
 	return false;
 }
 
-static void io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk)
+/*
+ * Returns true if we found and killed one or more timeouts
+ */
+static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk)
 {
 	struct io_kiocb *req, *tmp;
+	int canceled = 0;
 
 	spin_lock_irq(&ctx->completion_lock);
-	list_for_each_entry_safe(req, tmp, &ctx->timeout_list, list)
-		if (io_task_match(req, tsk))
+	list_for_each_entry_safe(req, tmp, &ctx->timeout_list, list) {
+		if (io_task_match(req, tsk)) {
 			io_kill_timeout(req);
+			canceled++;
+		}
+	}
 	spin_unlock_irq(&ctx->completion_lock);
+	return canceled != 0;
 }
 
 static void __io_queue_deferred(struct io_ring_ctx *ctx)
@@ -4650,7 +4658,10 @@ static bool io_poll_remove_one(struct io
 	return do_complete;
 }
 
-static void io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk)
+/*
+ * Returns true if we found and killed one or more poll requests
+ */
+static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk)
 {
 	struct hlist_node *tmp;
 	struct io_kiocb *req;
@@ -4670,6 +4681,8 @@ static void io_poll_remove_all(struct io
 
 	if (posted)
 		io_cqring_ev_posted(ctx);
+
+	return posted != 0;
 }
 
 static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
@@ -7744,11 +7757,14 @@ static void io_cancel_defer_files(struct
 	}
 }
 
-static void io_uring_cancel_files(struct io_ring_ctx *ctx,
+/*
+ * Returns true if we found and killed one or more files pinning requests
+ */
+static bool io_uring_cancel_files(struct io_ring_ctx *ctx,
 				  struct files_struct *files)
 {
 	if (list_empty_careful(&ctx->inflight_list))
-		return;
+		return false;
 
 	io_cancel_defer_files(ctx, files);
 	/* cancel all at once, should be faster than doing it one by one*/
@@ -7811,6 +7827,8 @@ static void io_uring_cancel_files(struct
 		schedule();
 		finish_wait(&ctx->inflight_wait, &wait);
 	}
+
+	return true;
 }
 
 static bool io_cancel_task_cb(struct io_wq_work *work, void *data)


Patches currently in stable-queue which might be from axboe@xxxxxxxxx are

queue-5.8/io_uring-convert-advanced-xarray-uses-to-the-normal-api.patch
queue-5.8/io_uring-don-t-run-task-work-on-an-exiting-task.patch
queue-5.8/io_uring-reference-nsproxy-for-file-table-commands.patch
queue-5.8/io_uring-stash-ctx-task-reference-for-sqpoll.patch
queue-5.8/io_uring-return-cancelation-status-from-poll-timeout-files-handlers.patch
queue-5.8/io_uring-fix-xarray-usage-in-io_uring_add_task_file.patch
queue-5.8/io_uring-fix-use-of-xarray-in-__io_uring_files_cancel.patch
queue-5.8/io-wq-fix-use-after-free-in-io_wq_worker_running.patch
queue-5.8/io_uring-don-t-rely-on-weak-files-references.patch
queue-5.8/io_uring-allow-timeout-poll-files-killing-to-take-task-into-account.patch
queue-5.8/io_uring-move-dropping-of-files-into-separate-helper.patch
queue-5.8/io_uring-unconditionally-grab-req-task.patch
queue-5.8/io_uring-enable-task-files-specific-overflow-flushing.patch
queue-5.8/io_wq-make-io_wqe-lock-a-raw_spinlock_t.patch
queue-5.8/io_uring-no-need-to-call-xa_destroy-on-empty-xarray.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux