Skip to content

Commit 1149871

Browse files
q2venkuba-moo
authored andcommitted
af_unix: Remove io_uring code for GC.
Since commit 705318a ("io_uring/af_unix: disable sending io_uring over sockets"), io_uring's unix socket cannot be passed via SCM_RIGHTS, so it does not contribute to cyclic reference and no longer be candidate for garbage collection. Also, commit 6e5e6d2 ("io_uring: drop any code related to SCM_RIGHTS") cleaned up SCM_RIGHTS code in io_uring. Let's do it in AF_UNIX as well by reverting commit 0091bfc ("io_uring/af_unix: defer registered files gc to io_uring release") and commit 1036908 ("net: reclaim skb->scm_io_uring bit"). Signed-off-by: Kuniyuki Iwashima <[email protected]> Acked-by: Jens Axboe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d0f6dc2 commit 1149871

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

include/net/af_unix.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ static inline struct unix_sock *unix_get_socket(struct file *filp)
2020
void unix_inflight(struct user_struct *user, struct file *fp);
2121
void unix_notinflight(struct user_struct *user, struct file *fp);
2222
void unix_destruct_scm(struct sk_buff *skb);
23-
void io_uring_destruct_scm(struct sk_buff *skb);
2423
void unix_gc(void);
2524
void wait_for_unix_gc(struct scm_fp_list *fpl);
2625
struct sock *unix_peer_get(struct sock *sk);

net/unix/garbage.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,10 @@ static bool gc_in_progress;
184184

185185
static void __unix_gc(struct work_struct *work)
186186
{
187-
struct sk_buff *next_skb, *skb;
188-
struct unix_sock *u;
189-
struct unix_sock *next;
190187
struct sk_buff_head hitlist;
191-
struct list_head cursor;
188+
struct unix_sock *u, *next;
192189
LIST_HEAD(not_cycle_list);
190+
struct list_head cursor;
193191

194192
spin_lock(&unix_gc_lock);
195193

@@ -269,30 +267,11 @@ static void __unix_gc(struct work_struct *work)
269267

270268
spin_unlock(&unix_gc_lock);
271269

272-
/* We need io_uring to clean its registered files, ignore all io_uring
273-
* originated skbs. It's fine as io_uring doesn't keep references to
274-
* other io_uring instances and so killing all other files in the cycle
275-
* will put all io_uring references forcing it to go through normal
276-
* release.path eventually putting registered files.
277-
*/
278-
skb_queue_walk_safe(&hitlist, skb, next_skb) {
279-
if (skb->destructor == io_uring_destruct_scm) {
280-
__skb_unlink(skb, &hitlist);
281-
skb_queue_tail(&skb->sk->sk_receive_queue, skb);
282-
}
283-
}
284-
285270
/* Here we are. Hitlist is filled. Die. */
286271
__skb_queue_purge(&hitlist);
287272

288273
spin_lock(&unix_gc_lock);
289274

290-
/* There could be io_uring registered files, just push them back to
291-
* the inflight list
292-
*/
293-
list_for_each_entry_safe(u, next, &gc_candidates, link)
294-
list_move_tail(&u->link, &gc_inflight_list);
295-
296275
/* All candidates should have been detached by now. */
297276
WARN_ON_ONCE(!list_empty(&gc_candidates));
298277

net/unix/scm.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,3 @@ void unix_destruct_scm(struct sk_buff *skb)
148148
sock_wfree(skb);
149149
}
150150
EXPORT_SYMBOL(unix_destruct_scm);
151-
152-
void io_uring_destruct_scm(struct sk_buff *skb)
153-
{
154-
unix_destruct_scm(skb);
155-
}
156-
EXPORT_SYMBOL(io_uring_destruct_scm);

0 commit comments

Comments
 (0)