diff options
Diffstat (limited to 'net/unix/garbage.c')
-rw-r--r-- | net/unix/garbage.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index a73a226f2d33..8fcdc2283af5 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -120,11 +120,11 @@ void unix_inflight(struct file *fp) | |||
120 | { | 120 | { |
121 | struct sock *s = unix_get_socket(fp); | 121 | struct sock *s = unix_get_socket(fp); |
122 | 122 | ||
123 | spin_lock(&unix_gc_lock); | ||
124 | |||
123 | if (s) { | 125 | if (s) { |
124 | struct unix_sock *u = unix_sk(s); | 126 | struct unix_sock *u = unix_sk(s); |
125 | 127 | ||
126 | spin_lock(&unix_gc_lock); | ||
127 | |||
128 | if (atomic_long_inc_return(&u->inflight) == 1) { | 128 | if (atomic_long_inc_return(&u->inflight) == 1) { |
129 | BUG_ON(!list_empty(&u->link)); | 129 | BUG_ON(!list_empty(&u->link)); |
130 | list_add_tail(&u->link, &gc_inflight_list); | 130 | list_add_tail(&u->link, &gc_inflight_list); |
@@ -132,25 +132,28 @@ void unix_inflight(struct file *fp) | |||
132 | BUG_ON(list_empty(&u->link)); | 132 | BUG_ON(list_empty(&u->link)); |
133 | } | 133 | } |
134 | unix_tot_inflight++; | 134 | unix_tot_inflight++; |
135 | spin_unlock(&unix_gc_lock); | ||
136 | } | 135 | } |
136 | fp->f_cred->user->unix_inflight++; | ||
137 | spin_unlock(&unix_gc_lock); | ||
137 | } | 138 | } |
138 | 139 | ||
139 | void unix_notinflight(struct file *fp) | 140 | void unix_notinflight(struct file *fp) |
140 | { | 141 | { |
141 | struct sock *s = unix_get_socket(fp); | 142 | struct sock *s = unix_get_socket(fp); |
142 | 143 | ||
144 | spin_lock(&unix_gc_lock); | ||
145 | |||
143 | if (s) { | 146 | if (s) { |
144 | struct unix_sock *u = unix_sk(s); | 147 | struct unix_sock *u = unix_sk(s); |
145 | 148 | ||
146 | spin_lock(&unix_gc_lock); | ||
147 | BUG_ON(list_empty(&u->link)); | 149 | BUG_ON(list_empty(&u->link)); |
148 | 150 | ||
149 | if (atomic_long_dec_and_test(&u->inflight)) | 151 | if (atomic_long_dec_and_test(&u->inflight)) |
150 | list_del_init(&u->link); | 152 | list_del_init(&u->link); |
151 | unix_tot_inflight--; | 153 | unix_tot_inflight--; |
152 | spin_unlock(&unix_gc_lock); | ||
153 | } | 154 | } |
155 | fp->f_cred->user->unix_inflight--; | ||
156 | spin_unlock(&unix_gc_lock); | ||
154 | } | 157 | } |
155 | 158 | ||
156 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | 159 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |