Merge branch 'vfs-scale-working' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6.git] / net / socket.c
index c1663c0..ccc576a 100644 (file)
@@ -262,6 +262,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
 }
 
 
+
 static void wq_free_rcu(struct rcu_head *head)
 {
        struct socket_wq *wq = container_of(head, struct socket_wq, rcu);
@@ -360,14 +361,14 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
        if (unlikely(fd < 0))
                return fd;
 
-       path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
+       path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name);
        if (unlikely(!path.dentry)) {
                put_unused_fd(fd);
                return -ENOMEM;
        }
        path.mnt = mntget(sock_mnt);
 
-       path.dentry->d_op = &sockfs_dentry_operations;
+       d_set_d_op(path.dentry, &sockfs_dentry_operations);
        d_instantiate(path.dentry, SOCK_INODE(sock));
        SOCK_INODE(sock)->i_fop = &socket_file_ops;
 
@@ -2390,6 +2391,8 @@ EXPORT_SYMBOL(sock_unregister);
 
 static int __init sock_init(void)
 {
+       int err;
+
        /*
         *      Initialize sock SLAB cache.
         */
@@ -2406,8 +2409,15 @@ static int __init sock_init(void)
         */
 
        init_inodecache();
-       register_filesystem(&sock_fs_type);
+
+       err = register_filesystem(&sock_fs_type);
+       if (err)
+               goto out_fs;
        sock_mnt = kern_mount(&sock_fs_type);
+       if (IS_ERR(sock_mnt)) {
+               err = PTR_ERR(sock_mnt);
+               goto out_mount;
+       }
 
        /* The real protocol initialization is performed in later initcalls.
         */
@@ -2420,7 +2430,13 @@ static int __init sock_init(void)
        skb_timestamping_init();
 #endif
 
-       return 0;
+out:
+       return err;
+
+out_mount:
+       unregister_filesystem(&sock_fs_type);
+out_fs:
+       goto out;
 }
 
 core_initcall(sock_init);      /* early initcall */