From 5372ca52503afaa5d94e55cbd8d3f25657e0ee75 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 19 May 2005 12:26:43 -0700 Subject: [PATCH] --- yaml --- r: 1261 b: refs/heads/master c: f81a0bffa116ea22149aa7cfb0b4ee09096d9d92 h: refs/heads/master i: 1259: 65606f65f189ab023bc7d672ded3ca30de34fb63 v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 1 + trunk/net/unix/af_unix.c | 28 +++------------------------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/[refs] b/[refs] index eaf3c5018f97..c8b9ac7f9e83 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2fdba6b085eb7068e9594cfa55ffe40466184b4d +refs/heads/master: f81a0bffa116ea22149aa7cfb0b4ee09096d9d92 diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index defe6781e003..dd78f01b6de8 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -1580,6 +1580,7 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir) fail: return dentry; } +EXPORT_SYMBOL_GPL(lookup_create); int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { diff --git a/trunk/net/unix/af_unix.c b/trunk/net/unix/af_unix.c index c478fc8db776..c420eba4876b 100644 --- a/trunk/net/unix/af_unix.c +++ b/trunk/net/unix/af_unix.c @@ -770,33 +770,12 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd); if (err) goto out_mknod_parent; - /* - * Yucky last component or no last component at all? - * (foo/., foo/.., /////) - */ - err = -EEXIST; - if (nd.last_type != LAST_NORM) - goto out_mknod; - /* - * Lock the directory. - */ - down(&nd.dentry->d_inode->i_sem); - /* - * Do the final lookup. - */ - dentry = lookup_hash(&nd.last, nd.dentry); + + dentry = lookup_create(&nd, 0); err = PTR_ERR(dentry); if (IS_ERR(dentry)) goto out_mknod_unlock; - err = -ENOENT; - /* - * Special case - lookup gave negative, but... we had foo/bar/ - * From the vfs_mknod() POV we just have a negative dentry - - * all is fine. Let's be bastards - you had / on the end, you've - * been asking for (non-existent) directory. -ENOENT for you. - */ - if (nd.last.name[nd.last.len] && !dentry->d_inode) - goto out_mknod_dput; + /* * All right, let's create it. */ @@ -845,7 +824,6 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) dput(dentry); out_mknod_unlock: up(&nd.dentry->d_inode->i_sem); -out_mknod: path_release(&nd); out_mknod_parent: if (err==-EEXIST)