diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-12 14:12:06 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-12 14:12:06 -0500 |
| commit | e697b8d13ede3893724898d983eff3f8c9183643 (patch) | |
| tree | 0144d2d98d33e92a1d93739f0db12997c000d456 /net/unix/garbage.c | |
| parent | 46015977e70f672ae6b20a1b5fb1e361208365ba (diff) | |
| parent | 2994c63863ac350c4c8c6a65d8110749c2abb95c (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (39 commits)
[INET]: Small possible memory leak in FIB rules
[NETNS]: init dev_base_lock only once
[UNIX]: The unix_nr_socks limit can be exceeded
[AF_UNIX]: Convert socks to unix_socks in scan_inflight, not in callbacks
[AF_UNIX]: Make unix_tot_inflight counter non-atomic
[AF_PACKET]: Allow multicast traffic to be caught by ORIGDEV when bonded
ssb: Fix PCMCIA-host lowlevel bus access
mac80211: fix MAC80211_RCSIMPLE Kconfig
mac80211: make "decrypt failed" messages conditional upon MAC80211_DEBUG
mac80211: use IW_AUTH_PRIVACY_INVOKED rather than IW_AUTH_KEY_MGMT
mac80211: remove unused driver ops
mac80211: remove ieee80211_common.h
softmac: MAINTAINERS update
rfkill: Fix sparse warning
rfkill: Use mutex_lock() at register and add sanity check
iwlwifi: select proper rate control algorithm
mac80211: allow driver to ask for a rate control algorithm
mac80211: don't allow registering the same rate control twice
rfkill: Use subsys_initcall
mac80211: make simple rate control algorithm built-in
...
Diffstat (limited to 'net/unix/garbage.c')
| -rw-r--r-- | net/unix/garbage.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 406b6433e467..ebdff3d877a1 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
| @@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list); | |||
| 92 | static LIST_HEAD(gc_candidates); | 92 | static LIST_HEAD(gc_candidates); |
| 93 | static DEFINE_SPINLOCK(unix_gc_lock); | 93 | static DEFINE_SPINLOCK(unix_gc_lock); |
| 94 | 94 | ||
| 95 | atomic_t unix_tot_inflight = ATOMIC_INIT(0); | 95 | unsigned int unix_tot_inflight; |
| 96 | 96 | ||
| 97 | 97 | ||
| 98 | static struct sock *unix_get_socket(struct file *filp) | 98 | static struct sock *unix_get_socket(struct file *filp) |
| @@ -133,7 +133,7 @@ void unix_inflight(struct file *fp) | |||
| 133 | } else { | 133 | } else { |
| 134 | BUG_ON(list_empty(&u->link)); | 134 | BUG_ON(list_empty(&u->link)); |
| 135 | } | 135 | } |
| 136 | atomic_inc(&unix_tot_inflight); | 136 | unix_tot_inflight++; |
| 137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| @@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp) | |||
| 147 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
| 148 | if (atomic_dec_and_test(&u->inflight)) | 148 | if (atomic_dec_and_test(&u->inflight)) |
| 149 | list_del_init(&u->link); | 149 | list_del_init(&u->link); |
| 150 | atomic_dec(&unix_tot_inflight); | 150 | unix_tot_inflight--; |
| 151 | spin_unlock(&unix_gc_lock); | 151 | spin_unlock(&unix_gc_lock); |
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| @@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk) | |||
| 161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ | 161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ |
| 162 | skb != sock_queue_head(sk); skb = next, next = skb->next) | 162 | skb != sock_queue_head(sk); skb = next, next = skb->next) |
| 163 | 163 | ||
| 164 | static void scan_inflight(struct sock *x, void (*func)(struct sock *), | 164 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |
| 165 | struct sk_buff_head *hitlist) | 165 | struct sk_buff_head *hitlist) |
| 166 | { | 166 | { |
| 167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
| @@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
| 185 | * if it indeed does so | 185 | * if it indeed does so |
| 186 | */ | 186 | */ |
| 187 | struct sock *sk = unix_get_socket(*fp++); | 187 | struct sock *sk = unix_get_socket(*fp++); |
| 188 | if(sk) { | 188 | if (sk) { |
| 189 | hit = true; | 189 | hit = true; |
| 190 | func(sk); | 190 | func(unix_sk(sk)); |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | if (hit && hitlist != NULL) { | 193 | if (hit && hitlist != NULL) { |
| @@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
| 199 | spin_unlock(&x->sk_receive_queue.lock); | 199 | spin_unlock(&x->sk_receive_queue.lock); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | static void scan_children(struct sock *x, void (*func)(struct sock *), | 202 | static void scan_children(struct sock *x, void (*func)(struct unix_sock *), |
| 203 | struct sk_buff_head *hitlist) | 203 | struct sk_buff_head *hitlist) |
| 204 | { | 204 | { |
| 205 | if (x->sk_state != TCP_LISTEN) | 205 | if (x->sk_state != TCP_LISTEN) |
| @@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *), | |||
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static void dec_inflight(struct sock *sk) | 238 | static void dec_inflight(struct unix_sock *usk) |
| 239 | { | 239 | { |
| 240 | atomic_dec(&unix_sk(sk)->inflight); | 240 | atomic_dec(&usk->inflight); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static void inc_inflight(struct sock *sk) | 243 | static void inc_inflight(struct unix_sock *usk) |
| 244 | { | 244 | { |
| 245 | atomic_inc(&unix_sk(sk)->inflight); | 245 | atomic_inc(&usk->inflight); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static void inc_inflight_move_tail(struct sock *sk) | 248 | static void inc_inflight_move_tail(struct unix_sock *u) |
| 249 | { | 249 | { |
| 250 | struct unix_sock *u = unix_sk(sk); | ||
| 251 | |||
| 252 | atomic_inc(&u->inflight); | 250 | atomic_inc(&u->inflight); |
| 253 | /* | 251 | /* |
| 254 | * If this is still a candidate, move it to the end of the | 252 | * If this is still a candidate, move it to the end of the |
