diff options
Diffstat (limited to 'net/unix/garbage.c')
| -rw-r--r-- | net/unix/garbage.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 190dea73f0ab..280b9b07b1c0 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -282,6 +282,8 @@ void unix_update_edges(struct unix_sock *receiver) } } +static void wait_for_unix_gc(struct scm_fp_list *fpl); + int unix_prepare_fpl(struct scm_fp_list *fpl) { struct unix_vertex *vertex; @@ -303,6 +305,8 @@ int unix_prepare_fpl(struct scm_fp_list *fpl) if (!fpl->edges) goto err; + wait_for_unix_gc(fpl); + return 0; err: @@ -628,7 +632,7 @@ void unix_schedule_gc(void) #define UNIX_INFLIGHT_TRIGGER_GC 16000 #define UNIX_INFLIGHT_SANE_USER (SCM_MAX_FD * 8) -void wait_for_unix_gc(struct scm_fp_list *fpl) +static void wait_for_unix_gc(struct scm_fp_list *fpl) { /* If number of inflight sockets is insane, * force a garbage collect right now. @@ -642,8 +646,7 @@ void wait_for_unix_gc(struct scm_fp_list *fpl) /* Penalise users who want to send AF_UNIX sockets * but whose sockets have not been received yet. */ - if (!fpl || !fpl->count_unix || - READ_ONCE(fpl->user->unix_inflight) < UNIX_INFLIGHT_SANE_USER) + if (READ_ONCE(fpl->user->unix_inflight) < UNIX_INFLIGHT_SANE_USER) return; if (READ_ONCE(gc_in_progress)) |