diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-14 21:54:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:41 -0400 |
commit | 40ffe67d2e89c7a475421d007becc11a2f88ea3d (patch) | |
tree | 5373e71b18895b9ffd8370a88aec6c54438240a0 /net | |
parent | 38eff2892628fa5c4fc8962a17b7296f42833ebe (diff) |
switch unix_sock to struct path
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/unix/af_unix.c | 35 | ||||
-rw-r--r-- | net/unix/diag.c | 2 |
2 files changed, 16 insertions, 21 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 85d3bb7490aa..ef4b780ef63d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -293,7 +293,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
293 | spin_lock(&unix_table_lock); | 293 | spin_lock(&unix_table_lock); |
294 | sk_for_each(s, node, | 294 | sk_for_each(s, node, |
295 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 295 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
296 | struct dentry *dentry = unix_sk(s)->dentry; | 296 | struct dentry *dentry = unix_sk(s)->path.dentry; |
297 | 297 | ||
298 | if (dentry && dentry->d_inode == i) { | 298 | if (dentry && dentry->d_inode == i) { |
299 | sock_hold(s); | 299 | sock_hold(s); |
@@ -377,8 +377,7 @@ static void unix_sock_destructor(struct sock *sk) | |||
377 | static int unix_release_sock(struct sock *sk, int embrion) | 377 | static int unix_release_sock(struct sock *sk, int embrion) |
378 | { | 378 | { |
379 | struct unix_sock *u = unix_sk(sk); | 379 | struct unix_sock *u = unix_sk(sk); |
380 | struct dentry *dentry; | 380 | struct path path; |
381 | struct vfsmount *mnt; | ||
382 | struct sock *skpair; | 381 | struct sock *skpair; |
383 | struct sk_buff *skb; | 382 | struct sk_buff *skb; |
384 | int state; | 383 | int state; |
@@ -389,10 +388,9 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
389 | unix_state_lock(sk); | 388 | unix_state_lock(sk); |
390 | sock_orphan(sk); | 389 | sock_orphan(sk); |
391 | sk->sk_shutdown = SHUTDOWN_MASK; | 390 | sk->sk_shutdown = SHUTDOWN_MASK; |
392 | dentry = u->dentry; | 391 | path = u->path; |
393 | u->dentry = NULL; | 392 | u->path.dentry = NULL; |
394 | mnt = u->mnt; | 393 | u->path.mnt = NULL; |
395 | u->mnt = NULL; | ||
396 | state = sk->sk_state; | 394 | state = sk->sk_state; |
397 | sk->sk_state = TCP_CLOSE; | 395 | sk->sk_state = TCP_CLOSE; |
398 | unix_state_unlock(sk); | 396 | unix_state_unlock(sk); |
@@ -425,10 +423,8 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
425 | kfree_skb(skb); | 423 | kfree_skb(skb); |
426 | } | 424 | } |
427 | 425 | ||
428 | if (dentry) { | 426 | if (path.dentry) |
429 | dput(dentry); | 427 | path_put(&path); |
430 | mntput(mnt); | ||
431 | } | ||
432 | 428 | ||
433 | sock_put(sk); | 429 | sock_put(sk); |
434 | 430 | ||
@@ -628,8 +624,8 @@ static struct sock *unix_create1(struct net *net, struct socket *sock) | |||
628 | sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; | 624 | sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; |
629 | sk->sk_destruct = unix_sock_destructor; | 625 | sk->sk_destruct = unix_sock_destructor; |
630 | u = unix_sk(sk); | 626 | u = unix_sk(sk); |
631 | u->dentry = NULL; | 627 | u->path.dentry = NULL; |
632 | u->mnt = NULL; | 628 | u->path.mnt = NULL; |
633 | spin_lock_init(&u->lock); | 629 | spin_lock_init(&u->lock); |
634 | atomic_long_set(&u->inflight, 0); | 630 | atomic_long_set(&u->inflight, 0); |
635 | INIT_LIST_HEAD(&u->link); | 631 | INIT_LIST_HEAD(&u->link); |
@@ -789,9 +785,9 @@ static struct sock *unix_find_other(struct net *net, | |||
789 | u = unix_find_socket_byname(net, sunname, len, type, hash); | 785 | u = unix_find_socket_byname(net, sunname, len, type, hash); |
790 | if (u) { | 786 | if (u) { |
791 | struct dentry *dentry; | 787 | struct dentry *dentry; |
792 | dentry = unix_sk(u)->dentry; | 788 | dentry = unix_sk(u)->path.dentry; |
793 | if (dentry) | 789 | if (dentry) |
794 | touch_atime(unix_sk(u)->mnt, dentry); | 790 | touch_atime(unix_sk(u)->path.mnt, dentry); |
795 | } else | 791 | } else |
796 | goto fail; | 792 | goto fail; |
797 | } | 793 | } |
@@ -897,8 +893,7 @@ out_mknod_drop_write: | |||
897 | list = &unix_socket_table[addr->hash]; | 893 | list = &unix_socket_table[addr->hash]; |
898 | } else { | 894 | } else { |
899 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; | 895 | list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; |
900 | u->dentry = path.dentry; | 896 | u->path = path; |
901 | u->mnt = path.mnt; | ||
902 | } | 897 | } |
903 | 898 | ||
904 | err = 0; | 899 | err = 0; |
@@ -1180,9 +1175,9 @@ restart: | |||
1180 | atomic_inc(&otheru->addr->refcnt); | 1175 | atomic_inc(&otheru->addr->refcnt); |
1181 | newu->addr = otheru->addr; | 1176 | newu->addr = otheru->addr; |
1182 | } | 1177 | } |
1183 | if (otheru->dentry) { | 1178 | if (otheru->path.dentry) { |
1184 | newu->dentry = dget(otheru->dentry); | 1179 | path_get(&otheru->path); |
1185 | newu->mnt = mntget(otheru->mnt); | 1180 | newu->path = otheru->path; |
1186 | } | 1181 | } |
1187 | 1182 | ||
1188 | /* Set credentials */ | 1183 | /* Set credentials */ |
diff --git a/net/unix/diag.c b/net/unix/diag.c index 6b7697fd911b..ffd86518e646 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -29,7 +29,7 @@ rtattr_failure: | |||
29 | 29 | ||
30 | static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb) | 30 | static int sk_diag_dump_vfs(struct sock *sk, struct sk_buff *nlskb) |
31 | { | 31 | { |
32 | struct dentry *dentry = unix_sk(sk)->dentry; | 32 | struct dentry *dentry = unix_sk(sk)->path.dentry; |
33 | struct unix_diag_vfs *uv; | 33 | struct unix_diag_vfs *uv; |
34 | 34 | ||
35 | if (dentry) { | 35 | if (dentry) { |