X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Funix%2Fgarbage.c;h=f14ad6635fccf15a324831a1d094ed6d529cd8cb;hb=refs%2Fheads%2Fvserver;hp=3d5e1a5f433f0ed1e7a8d68937157b5c9af52865;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 3d5e1a5f4..f14ad6635 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -76,11 +76,12 @@ #include #include #include -#include +#include #include #include #include +#include /* Internal data structures and random procedures: */ @@ -95,12 +96,12 @@ atomic_t unix_tot_inflight = ATOMIC_INIT(0); static struct sock *unix_get_socket(struct file *filp) { struct sock *u_sock = NULL; - struct inode *inode = filp->f_dentry->d_inode; + struct inode *inode = filp->f_path.dentry->d_inode; /* * Socket ? */ - if (inode->i_sock) { + if (S_ISSOCK(inode->i_mode)) { struct socket * sock = SOCKET_I(inode); struct sock * s = sock->sk; @@ -169,7 +170,7 @@ static void maybe_unmark_and_push(struct sock *x) void unix_gc(void) { - static DECLARE_MUTEX(unix_gc_sem); + static DEFINE_MUTEX(unix_gc_sem); int i; struct sock *s; struct sk_buff_head hitlist; @@ -179,10 +180,10 @@ void unix_gc(void) * Avoid a recursive GC. */ - if (down_trylock(&unix_gc_sem)) + if (!mutex_trylock(&unix_gc_sem)) return; - read_lock(&unix_table_lock); + spin_lock(&unix_table_lock); forall_unix_sockets(i, s) { @@ -286,27 +287,27 @@ void unix_gc(void) skb = skb_peek(&s->sk_receive_queue); while (skb && skb != (struct sk_buff *)&s->sk_receive_queue) { - nextsk=skb->next; + nextsk = skb->next; /* * Do we have file descriptors ? */ - if(UNIXCB(skb).fp) - { - __skb_unlink(skb, skb->list); - __skb_queue_tail(&hitlist,skb); + if (UNIXCB(skb).fp) { + __skb_unlink(skb, + &s->sk_receive_queue); + __skb_queue_tail(&hitlist, skb); } - skb=nextsk; + skb = nextsk; } spin_unlock(&s->sk_receive_queue.lock); } u->gc_tree = GC_ORPHAN; } - read_unlock(&unix_table_lock); + spin_unlock(&unix_table_lock); /* * Here we are. Hitlist is filled. Die. */ __skb_queue_purge(&hitlist); - up(&unix_gc_sem); + mutex_unlock(&unix_gc_sem); }