All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2][5.9 backport] io_uring: get an active ref_node from files_data
@ 2020-11-23 22:34 Pavel Begunkov
  2020-11-23 22:34 ` [PATCH 2/2][5.9 backport] io_uring: order refnode recycling Pavel Begunkov
  2020-11-24 16:50 ` [PATCH 1/2][5.9 backport] io_uring: get an active ref_node from files_data Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Begunkov @ 2020-11-23 22:34 UTC (permalink / raw)
  To: gregkh, stable; +Cc: Jens Axboe

commit 1e5d770bb8a23dd01e28e92f4fb0b1093c8bdbe6 upstream

An active ref_node always can be found in ctx->files_data, it's much
safer to get it this way instead of poking into files_data->ref_list.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/io_uring.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 352bd3ad446b..24c0ad17ec4c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6855,9 +6855,8 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
 		return -ENXIO;
 
 	spin_lock(&data->lock);
-	if (!list_empty(&data->ref_list))
-		ref_node = list_first_entry(&data->ref_list,
-				struct fixed_file_ref_node, node);
+	ref_node = container_of(data->cur_refs, struct fixed_file_ref_node,
+				refs);
 	spin_unlock(&data->lock);
 	if (ref_node)
 		percpu_ref_kill(&ref_node->refs);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-24 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-23 22:34 [PATCH 1/2][5.9 backport] io_uring: get an active ref_node from files_data Pavel Begunkov
2020-11-23 22:34 ` [PATCH 2/2][5.9 backport] io_uring: order refnode recycling Pavel Begunkov
2020-11-24 16:50 ` [PATCH 1/2][5.9 backport] io_uring: get an active ref_node from files_data Greg KH

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.