diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2008-02-15 17:37:57 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-19 00:25:34 -0400 |
commit | 463c3197263bd26ac59a00d2484990e17e35c50e (patch) | |
tree | b27c04f978ccd447ae33f7387b6a4aba0033acc5 /net/unix/af_unix.c | |
parent | 0622753b800e4cc6cb9319b36b27658c72dd7cdc (diff) |
[PATCH] r/o bind mounts: get callers of vfs_mknod/create/mkdir()
This takes care of all of the direct callers of vfs_mknod().
Since a few of these cases also handle normal file creation
as well, this also covers some calls to vfs_create().
So that we don't have to make three mnt_want/drop_write()
calls inside of the switch statement, we move some of its
logic outside of the switch and into a helper function
suggested by Christoph.
This also encapsulates a fix for mknod(S_IFREG) that Miklos
found.
[AV: merged mkdir handling, added missing nfsd pieces]
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2851d0d15048..1454afcc06c4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -819,7 +819,11 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
819 | */ | 819 | */ |
820 | mode = S_IFSOCK | | 820 | mode = S_IFSOCK | |
821 | (SOCK_INODE(sock)->i_mode & ~current->fs->umask); | 821 | (SOCK_INODE(sock)->i_mode & ~current->fs->umask); |
822 | err = mnt_want_write(nd.path.mnt); | ||
823 | if (err) | ||
824 | goto out_mknod_dput; | ||
822 | err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0); | 825 | err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0); |
826 | mnt_drop_write(nd.path.mnt); | ||
823 | if (err) | 827 | if (err) |
824 | goto out_mknod_dput; | 828 | goto out_mknod_dput; |
825 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | 829 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |