Commit f81a0bffa116ea22149aa7cfb0b4ee09096d9d92
Committed by
David S. Miller
1 parent
2fdba6b085
Exists in
master
and in
4 other branches
[AF_UNIX]: Use lookup_create().
currently it opencodes it, but that's in the way of chaning the lookup_hash interface. I'd prefer to disallow modular af_unix over exporting lookup_create, but I'll leave that to you. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 4 additions and 25 deletions Side-by-side Diff
fs/namei.c
net/unix/af_unix.c
... | ... | @@ -770,34 +770,13 @@ |
770 | 770 | err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd); |
771 | 771 | if (err) |
772 | 772 | goto out_mknod_parent; |
773 | - /* | |
774 | - * Yucky last component or no last component at all? | |
775 | - * (foo/., foo/.., /////) | |
776 | - */ | |
777 | - err = -EEXIST; | |
778 | - if (nd.last_type != LAST_NORM) | |
779 | - goto out_mknod; | |
780 | - /* | |
781 | - * Lock the directory. | |
782 | - */ | |
783 | - down(&nd.dentry->d_inode->i_sem); | |
784 | - /* | |
785 | - * Do the final lookup. | |
786 | - */ | |
787 | - dentry = lookup_hash(&nd.last, nd.dentry); | |
773 | + | |
774 | + dentry = lookup_create(&nd, 0); | |
788 | 775 | err = PTR_ERR(dentry); |
789 | 776 | if (IS_ERR(dentry)) |
790 | 777 | goto out_mknod_unlock; |
791 | - err = -ENOENT; | |
778 | + | |
792 | 779 | /* |
793 | - * Special case - lookup gave negative, but... we had foo/bar/ | |
794 | - * From the vfs_mknod() POV we just have a negative dentry - | |
795 | - * all is fine. Let's be bastards - you had / on the end, you've | |
796 | - * been asking for (non-existent) directory. -ENOENT for you. | |
797 | - */ | |
798 | - if (nd.last.name[nd.last.len] && !dentry->d_inode) | |
799 | - goto out_mknod_dput; | |
800 | - /* | |
801 | 780 | * All right, let's create it. |
802 | 781 | */ |
803 | 782 | mode = S_IFSOCK | |
... | ... | @@ -845,7 +824,6 @@ |
845 | 824 | dput(dentry); |
846 | 825 | out_mknod_unlock: |
847 | 826 | up(&nd.dentry->d_inode->i_sem); |
848 | -out_mknod: | |
849 | 827 | path_release(&nd); |
850 | 828 | out_mknod_parent: |
851 | 829 | if (err==-EEXIST) |