Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

switch unix_sock to struct path

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 40ffe67d 38eff289

+19 -29
+1 -2
include/net/af_unix.h
··· 49 49 /* WARNING: sk has to be the first member */ 50 50 struct sock sk; 51 51 struct unix_address *addr; 52 - struct dentry *dentry; 53 - struct vfsmount *mnt; 52 + struct path path; 54 53 struct mutex readlock; 55 54 struct sock *peer; 56 55 struct sock *other;
+15 -20
net/unix/af_unix.c
··· 293 293 spin_lock(&unix_table_lock); 294 294 sk_for_each(s, node, 295 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 298 if (dentry && dentry->d_inode == i) { 299 299 sock_hold(s); ··· 377 377 static int unix_release_sock(struct sock *sk, int embrion) 378 378 { 379 379 struct unix_sock *u = unix_sk(sk); 380 - struct dentry *dentry; 381 - struct vfsmount *mnt; 380 + struct path path; 382 381 struct sock *skpair; 383 382 struct sk_buff *skb; 384 383 int state; ··· 388 389 unix_state_lock(sk); 389 390 sock_orphan(sk); 390 391 sk->sk_shutdown = SHUTDOWN_MASK; 391 - dentry = u->dentry; 392 - u->dentry = NULL; 393 - mnt = u->mnt; 394 - u->mnt = NULL; 392 + path = u->path; 393 + u->path.dentry = NULL; 394 + u->path.mnt = NULL; 395 395 state = sk->sk_state; 396 396 sk->sk_state = TCP_CLOSE; 397 397 unix_state_unlock(sk); ··· 423 425 kfree_skb(skb); 424 426 } 425 427 426 - if (dentry) { 427 - dput(dentry); 428 - mntput(mnt); 429 - } 428 + if (path.dentry) 429 + path_put(&path); 430 430 431 431 sock_put(sk); 432 432 ··· 624 628 sk->sk_max_ack_backlog = net->unx.sysctl_max_dgram_qlen; 625 629 sk->sk_destruct = unix_sock_destructor; 626 630 u = unix_sk(sk); 627 - u->dentry = NULL; 628 - u->mnt = NULL; 631 + u->path.dentry = NULL; 632 + u->path.mnt = NULL; 629 633 spin_lock_init(&u->lock); 630 634 atomic_long_set(&u->inflight, 0); 631 635 INIT_LIST_HEAD(&u->link); ··· 785 789 u = unix_find_socket_byname(net, sunname, len, type, hash); 786 790 if (u) { 787 791 struct dentry *dentry; 788 - dentry = unix_sk(u)->dentry; 792 + dentry = unix_sk(u)->path.dentry; 789 793 if (dentry) 790 - touch_atime(unix_sk(u)->mnt, dentry); 794 + touch_atime(unix_sk(u)->path.mnt, dentry); 791 795 } else 792 796 goto fail; 793 797 } ··· 893 897 list = &unix_socket_table[addr->hash]; 894 898 } else { 895 899 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; 896 - u->dentry = path.dentry; 897 - u->mnt = path.mnt; 900 + u->path = path; 898 901 } 899 902 900 903 err = 0; ··· 1175 1180 atomic_inc(&otheru->addr->refcnt); 1176 1181 newu->addr = otheru->addr; 1177 1182 } 1178 - if (otheru->dentry) { 1179 - newu->dentry = dget(otheru->dentry); 1180 - newu->mnt = mntget(otheru->mnt); 1183 + if (otheru->path.dentry) { 1184 + path_get(&otheru->path); 1185 + newu->path = otheru->path; 1181 1186 } 1182 1187 1183 1188 /* Set credentials */
+1 -1
net/unix/diag.c
··· 29 29 30 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 33 struct unix_diag_vfs *uv; 34 34 35 35 if (dentry) {
+2 -6
security/lsm_audit.c
··· 313 313 } 314 314 case AF_UNIX: 315 315 u = unix_sk(sk); 316 - if (u->dentry) { 317 - struct path path = { 318 - .dentry = u->dentry, 319 - .mnt = u->mnt 320 - }; 321 - audit_log_d_path(ab, " path=", &path); 316 + if (u->path.dentry) { 317 + audit_log_d_path(ab, " path=", &u->path); 322 318 break; 323 319 } 324 320 if (!u->addr)