aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 22:02:39 -0400
commitbbd9d6f7fbb0305c9a592bf05a32e87eb364a4ff (patch)
tree12b2bb4202b05f6ae6a43c6ce830a0472043dbe5 /net
parent8e204874db000928e37199c2db82b7eb8966cc3c (diff)
parent5a9a43646cf709312d71eca71cef90ad802f28f9 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (107 commits) vfs: use ERR_CAST for err-ptr tossing in lookup_instantiate_filp isofs: Remove global fs lock jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory fix IN_DELETE_SELF on overwriting rename() on ramfs et.al. mm/truncate.c: fix build for CONFIG_BLOCK not enabled fs:update the NOTE of the file_operations structure Remove dead code in dget_parent() AFS: Fix silly characters in a comment switch d_add_ci() to d_splice_alias() in "found negative" case as well simplify gfs2_lookup() jfs_lookup(): don't bother with . or .. get rid of useless dget_parent() in btrfs rename() and link() get rid of useless dget_parent() in fs/btrfs/ioctl.c fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers drivers: fix up various ->llseek() implementations fs: handle SEEK_HOLE/SEEK_DATA properly in all fs's that define their own llseek Ext4: handle SEEK_HOLE/SEEK_DATA generically Btrfs: implement our own ->llseek fs: add SEEK_HOLE and SEEK_DATA flags reiserfs: make reiserfs default to barrier=flush ... Fix up trivial conflicts in fs/xfs/linux-2.6/xfs_super.c due to the new shrinker callout for the inode cache, that clashed with the xfs code to start the periodic workers later.
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c11
-rw-r--r--net/unix/af_unix.c38
2 files changed, 22 insertions, 27 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 7389b7da3a8d..c50818f0473b 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -97,8 +97,7 @@ static int
97rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) 97rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
98{ 98{
99 static uint32_t clntid; 99 static uint32_t clntid;
100 struct nameidata nd; 100 struct path path, dir;
101 struct path path;
102 char name[15]; 101 char name[15];
103 struct qstr q = { 102 struct qstr q = {
104 .name = name, 103 .name = name,
@@ -113,7 +112,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
113 path.mnt = rpc_get_mount(); 112 path.mnt = rpc_get_mount();
114 if (IS_ERR(path.mnt)) 113 if (IS_ERR(path.mnt))
115 return PTR_ERR(path.mnt); 114 return PTR_ERR(path.mnt);
116 error = vfs_path_lookup(path.mnt->mnt_root, path.mnt, dir_name, 0, &nd); 115 error = vfs_path_lookup(path.mnt->mnt_root, path.mnt, dir_name, 0, &dir);
117 if (error) 116 if (error)
118 goto err; 117 goto err;
119 118
@@ -121,7 +120,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
121 q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++); 120 q.len = snprintf(name, sizeof(name), "clnt%x", (unsigned int)clntid++);
122 name[sizeof(name) - 1] = '\0'; 121 name[sizeof(name) - 1] = '\0';
123 q.hash = full_name_hash(q.name, q.len); 122 q.hash = full_name_hash(q.name, q.len);
124 path.dentry = rpc_create_client_dir(nd.path.dentry, &q, clnt); 123 path.dentry = rpc_create_client_dir(dir.dentry, &q, clnt);
125 if (!IS_ERR(path.dentry)) 124 if (!IS_ERR(path.dentry))
126 break; 125 break;
127 error = PTR_ERR(path.dentry); 126 error = PTR_ERR(path.dentry);
@@ -132,11 +131,11 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
132 goto err_path_put; 131 goto err_path_put;
133 } 132 }
134 } 133 }
135 path_put(&nd.path); 134 path_put(&dir);
136 clnt->cl_path = path; 135 clnt->cl_path = path;
137 return 0; 136 return 0;
138err_path_put: 137err_path_put:
139 path_put(&nd.path); 138 path_put(&dir);
140err: 139err:
141 rpc_put_mount(); 140 rpc_put_mount();
142 return error; 141 return error;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 0722a25a3a33..ec68e1c05b85 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -808,8 +808,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
808 struct net *net = sock_net(sk); 808 struct net *net = sock_net(sk);
809 struct unix_sock *u = unix_sk(sk); 809 struct unix_sock *u = unix_sk(sk);
810 struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; 810 struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
811 char *sun_path = sunaddr->sun_path;
811 struct dentry *dentry = NULL; 812 struct dentry *dentry = NULL;
812 struct nameidata nd; 813 struct path path;
813 int err; 814 int err;
814 unsigned hash; 815 unsigned hash;
815 struct unix_address *addr; 816 struct unix_address *addr;
@@ -845,48 +846,44 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
845 addr->hash = hash ^ sk->sk_type; 846 addr->hash = hash ^ sk->sk_type;
846 atomic_set(&addr->refcnt, 1); 847 atomic_set(&addr->refcnt, 1);
847 848
848 if (sunaddr->sun_path[0]) { 849 if (sun_path[0]) {
849 unsigned int mode; 850 unsigned int mode;
850 err = 0; 851 err = 0;
851 /* 852 /*
852 * Get the parent directory, calculate the hash for last 853 * Get the parent directory, calculate the hash for last
853 * component. 854 * component.
854 */ 855 */
855 err = kern_path_parent(sunaddr->sun_path, &nd); 856 dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0);
856 if (err)
857 goto out_mknod_parent;
858
859 dentry = lookup_create(&nd, 0);
860 err = PTR_ERR(dentry); 857 err = PTR_ERR(dentry);
861 if (IS_ERR(dentry)) 858 if (IS_ERR(dentry))
862 goto out_mknod_unlock; 859 goto out_mknod_parent;
863 860
864 /* 861 /*
865 * All right, let's create it. 862 * All right, let's create it.
866 */ 863 */
867 mode = S_IFSOCK | 864 mode = S_IFSOCK |
868 (SOCK_INODE(sock)->i_mode & ~current_umask()); 865 (SOCK_INODE(sock)->i_mode & ~current_umask());
869 err = mnt_want_write(nd.path.mnt); 866 err = mnt_want_write(path.mnt);
870 if (err) 867 if (err)
871 goto out_mknod_dput; 868 goto out_mknod_dput;
872 err = security_path_mknod(&nd.path, dentry, mode, 0); 869 err = security_path_mknod(&path, dentry, mode, 0);
873 if (err) 870 if (err)
874 goto out_mknod_drop_write; 871 goto out_mknod_drop_write;
875 err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0); 872 err = vfs_mknod(path.dentry->d_inode, dentry, mode, 0);
876out_mknod_drop_write: 873out_mknod_drop_write:
877 mnt_drop_write(nd.path.mnt); 874 mnt_drop_write(path.mnt);
878 if (err) 875 if (err)
879 goto out_mknod_dput; 876 goto out_mknod_dput;
880 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 877 mutex_unlock(&path.dentry->d_inode->i_mutex);
881 dput(nd.path.dentry); 878 dput(path.dentry);
882 nd.path.dentry = dentry; 879 path.dentry = dentry;
883 880
884 addr->hash = UNIX_HASH_SIZE; 881 addr->hash = UNIX_HASH_SIZE;
885 } 882 }
886 883
887 spin_lock(&unix_table_lock); 884 spin_lock(&unix_table_lock);
888 885
889 if (!sunaddr->sun_path[0]) { 886 if (!sun_path[0]) {
890 err = -EADDRINUSE; 887 err = -EADDRINUSE;
891 if (__unix_find_socket_byname(net, sunaddr, addr_len, 888 if (__unix_find_socket_byname(net, sunaddr, addr_len,
892 sk->sk_type, hash)) { 889 sk->sk_type, hash)) {
@@ -897,8 +894,8 @@ out_mknod_drop_write:
897 list = &unix_socket_table[addr->hash]; 894 list = &unix_socket_table[addr->hash];
898 } else { 895 } else {
899 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)]; 896 list = &unix_socket_table[dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1)];
900 u->dentry = nd.path.dentry; 897 u->dentry = path.dentry;
901 u->mnt = nd.path.mnt; 898 u->mnt = path.mnt;
902 } 899 }
903 900
904 err = 0; 901 err = 0;
@@ -915,9 +912,8 @@ out:
915 912
916out_mknod_dput: 913out_mknod_dput:
917 dput(dentry); 914 dput(dentry);
918out_mknod_unlock: 915 mutex_unlock(&path.dentry->d_inode->i_mutex);
919 mutex_unlock(&nd.path.dentry->d_inode->i_mutex); 916 path_put(&path);
920 path_put(&nd.path);
921out_mknod_parent: 917out_mknod_parent:
922 if (err == -EEXIST) 918 if (err == -EEXIST)
923 err = -EADDRINUSE; 919 err = -EADDRINUSE;