Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / unix / garbage.c
index 6ffc64e1712d291f40723109db1a774e507c738c..f8bcf5d114d9738ba86e84d58fde8d84ffba708e 100644 (file)
@@ -63,7 +63,7 @@
  *             Damn. Added missing check for ->dead in listen queues scanning.
  *
  */
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
@@ -76,6 +76,7 @@
 #include <linux/netdevice.h>
 #include <linux/file.h>
 #include <linux/proc_fs.h>
+#include <linux/mutex.h>
 
 #include <net/sock.h>
 #include <net/af_unix.h>
@@ -95,7 +96,7 @@ 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 ?
@@ -117,7 +118,7 @@ static struct sock *unix_get_socket(struct file *filp)
  *     Keep the number of times in flight count for the file
  *     descriptor if it is for an AF_UNIX socket.
  */
+
 void unix_inflight(struct file *fp)
 {
        struct sock *s = unix_get_socket(fp);
@@ -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,17 +180,17 @@ 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)
        {
                unix_sk(s)->gc_tree = GC_ORPHAN;
        }
        /*
-        *      Everything is now marked 
+        *      Everything is now marked
         */
 
        /* Invariant to be maintained:
@@ -226,7 +227,7 @@ void unix_gc(void)
        }
 
        /*
-        *      Mark phase 
+        *      Mark phase
         */
 
        while (!empty_stack())
@@ -236,11 +237,11 @@ void unix_gc(void)
 
                spin_lock(&x->sk_receive_queue.lock);
                skb = skb_peek(&x->sk_receive_queue);
-               
+
                /*
-                *      Loop through all but first born 
+                *      Loop through all but first born
                 */
-               
+
                while (skb && skb != (struct sk_buff *)&x->sk_receive_queue) {
                        /*
                         *      Do we have file descriptors ?
@@ -301,12 +302,12 @@ void unix_gc(void)
                }
                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);
 }