aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/socket.c24
-rw-r--r--net/sunrpc/rpc_pipe.c14
2 files changed, 31 insertions, 7 deletions
diff --git a/net/socket.c b/net/socket.c
index c1663c0ff3d3..ccc576a6a508 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -262,6 +262,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb)
262} 262}
263 263
264 264
265
265static void wq_free_rcu(struct rcu_head *head) 266static void wq_free_rcu(struct rcu_head *head)
266{ 267{
267 struct socket_wq *wq = container_of(head, struct socket_wq, rcu); 268 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)
360 if (unlikely(fd < 0)) 361 if (unlikely(fd < 0))
361 return fd; 362 return fd;
362 363
363 path.dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name); 364 path.dentry = d_alloc_pseudo(sock_mnt->mnt_sb, &name);
364 if (unlikely(!path.dentry)) { 365 if (unlikely(!path.dentry)) {
365 put_unused_fd(fd); 366 put_unused_fd(fd);
366 return -ENOMEM; 367 return -ENOMEM;
367 } 368 }
368 path.mnt = mntget(sock_mnt); 369 path.mnt = mntget(sock_mnt);
369 370
370 path.dentry->d_op = &sockfs_dentry_operations; 371 d_set_d_op(path.dentry, &sockfs_dentry_operations);
371 d_instantiate(path.dentry, SOCK_INODE(sock)); 372 d_instantiate(path.dentry, SOCK_INODE(sock));
372 SOCK_INODE(sock)->i_fop = &socket_file_ops; 373 SOCK_INODE(sock)->i_fop = &socket_file_ops;
373 374
@@ -2390,6 +2391,8 @@ EXPORT_SYMBOL(sock_unregister);
2390 2391
2391static int __init sock_init(void) 2392static int __init sock_init(void)
2392{ 2393{
2394 int err;
2395
2393 /* 2396 /*
2394 * Initialize sock SLAB cache. 2397 * Initialize sock SLAB cache.
2395 */ 2398 */
@@ -2406,8 +2409,15 @@ static int __init sock_init(void)
2406 */ 2409 */
2407 2410
2408 init_inodecache(); 2411 init_inodecache();
2409 register_filesystem(&sock_fs_type); 2412
2413 err = register_filesystem(&sock_fs_type);
2414 if (err)
2415 goto out_fs;
2410 sock_mnt = kern_mount(&sock_fs_type); 2416 sock_mnt = kern_mount(&sock_fs_type);
2417 if (IS_ERR(sock_mnt)) {
2418 err = PTR_ERR(sock_mnt);
2419 goto out_mount;
2420 }
2411 2421
2412 /* The real protocol initialization is performed in later initcalls. 2422 /* The real protocol initialization is performed in later initcalls.
2413 */ 2423 */
@@ -2420,7 +2430,13 @@ static int __init sock_init(void)
2420 skb_timestamping_init(); 2430 skb_timestamping_init();
2421#endif 2431#endif
2422 2432
2423 return 0; 2433out:
2434 return err;
2435
2436out_mount:
2437 unregister_filesystem(&sock_fs_type);
2438out_fs:
2439 goto out;
2424} 2440}
2425 2441
2426core_initcall(sock_init); /* early initcall */ 2442core_initcall(sock_init); /* early initcall */
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 10a17a37ec4e..09f01f41e55a 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -162,11 +162,19 @@ rpc_alloc_inode(struct super_block *sb)
162} 162}
163 163
164static void 164static void
165rpc_destroy_inode(struct inode *inode) 165rpc_i_callback(struct rcu_head *head)
166{ 166{
167 struct inode *inode = container_of(head, struct inode, i_rcu);
168 INIT_LIST_HEAD(&inode->i_dentry);
167 kmem_cache_free(rpc_inode_cachep, RPC_I(inode)); 169 kmem_cache_free(rpc_inode_cachep, RPC_I(inode));
168} 170}
169 171
172static void
173rpc_destroy_inode(struct inode *inode)
174{
175 call_rcu(&inode->i_rcu, rpc_i_callback);
176}
177
170static int 178static int
171rpc_pipe_open(struct inode *inode, struct file *filp) 179rpc_pipe_open(struct inode *inode, struct file *filp)
172{ 180{
@@ -430,7 +438,7 @@ void rpc_put_mount(void)
430} 438}
431EXPORT_SYMBOL_GPL(rpc_put_mount); 439EXPORT_SYMBOL_GPL(rpc_put_mount);
432 440
433static int rpc_delete_dentry(struct dentry *dentry) 441static int rpc_delete_dentry(const struct dentry *dentry)
434{ 442{
435 return 1; 443 return 1;
436} 444}
@@ -583,7 +591,7 @@ static struct dentry *__rpc_lookup_create(struct dentry *parent,
583 } 591 }
584 } 592 }
585 if (!dentry->d_inode) 593 if (!dentry->d_inode)
586 dentry->d_op = &rpc_dentry_operations; 594 d_set_d_op(dentry, &rpc_dentry_operations);
587out_err: 595out_err:
588 return dentry; 596 return dentry;
589} 597}