summary refs log tree commit diff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2008-02-15 14:37:49 -0800
committerAl Viro <viro@zeniv.linux.org.uk>2008-04-19 00:25:34 -0400
commit9079b1eb1753f217c3de9f1b7dd7fd549cc3f0cf (patch)
tree8e522ad0b16829849e4b1602270eb10997fba41d /fs/namei.c
parent75c3f29de7451677c59580b0a959f694f36aac28 (diff)
downloadlinux-9079b1eb1753f217c3de9f1b7dd7fd549cc3f0cf.tar.gz
[PATCH] r/o bind mounts: get write access for vfs_rename() callers
This also uses the little helper in the NFS code to make an if() a little bit
less ugly.  We introduced the helper at the beginning of the series.

Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@lst.de>
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 'fs/namei.c')
-rw-r--r--fs/namei.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 00df735fb509..83c843b3fea3 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2718,8 +2718,12 @@ static int do_rename(int olddfd, const char *oldname,
 	if (new_dentry == trap)
 		goto exit5;
 
+	error = mnt_want_write(oldnd.path.mnt);
+	if (error)
+		goto exit5;
 	error = vfs_rename(old_dir->d_inode, old_dentry,
 				   new_dir->d_inode, new_dentry);
+	mnt_drop_write(oldnd.path.mnt);
 exit5:
 	dput(new_dentry);
 exit4: