- ro-bind-mounts-r-o-bind-mount-prepwork-move-open_nameis-vfs_create.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     r/o bind mounts: r/o bind mount prepwork: move open_namei()'s vfs_create()

has been removed from the -mm tree.  Its filename is

     ro-bind-mounts-r-o-bind-mount-prepwork-move-open_nameis-vfs_create.patch

This patch was dropped because Viro's comments sounded rather serious

------------------------------------------------------
Subject: r/o bind mounts: r/o bind mount prepwork: move open_namei()'s vfs_create()
From: Dave Hansen <haveblue@xxxxxxxxxx>

The code around vfs_create() in open_namei() is getting a bit too complex. 
Right now, there is at least the reference count on the dentry, and the
i_mutex to worry about.  Soon, we'll also have mnt_writecount.

So, break the vfs_create() call out of open_namei(), and into a helper
function.  This duplicates the call to may_open(), but that isn't such a bad
thing since the arguments (acc_mode and flag) were being heavily massaged
anyway.

Later in the series, we'll add the mnt_writecount handling around this new
function call.

Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
Cc: Serge Hallyn <serue@xxxxxxxxxx>
Cc: Herbert Poetzl <herbert@xxxxxxxxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/namei.c |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff -puN fs/namei.c~ro-bind-mounts-r-o-bind-mount-prepwork-move-open_nameis-vfs_create fs/namei.c
--- a/fs/namei.c~ro-bind-mounts-r-o-bind-mount-prepwork-move-open_nameis-vfs_create
+++ a/fs/namei.c
@@ -1580,6 +1580,24 @@ int may_open(struct nameidata *nd, int a
 	return 0;
 }
 
+static int open_namei_create(struct nameidata *nd, struct path *path,
+				int flag, int mode)
+{
+	int error;
+	struct dentry *dir = nd->dentry;
+
+	if (!IS_POSIXACL(dir->d_inode))
+		mode &= ~current->fs->umask;
+	error = vfs_create(dir->d_inode, path->dentry, mode, nd);
+	mutex_unlock(&dir->d_inode->i_mutex);
+	dput(nd->dentry);
+	nd->dentry = path->dentry;
+	if (error)
+		return error;
+	/* Don't check for write permission, don't truncate */
+	return may_open(nd, 0, flag & ~O_TRUNC);
+}
+
 /*
  *	open_namei()
  *
@@ -1661,18 +1679,10 @@ do_last:
 
 	/* Negative dentry, just create the file */
 	if (!path.dentry->d_inode) {
-		if (!IS_POSIXACL(dir->d_inode))
-			mode &= ~current->fs->umask;
-		error = vfs_create(dir->d_inode, path.dentry, mode, nd);
-		mutex_unlock(&dir->d_inode->i_mutex);
-		dput(nd->dentry);
-		nd->dentry = path.dentry;
+		error = open_namei_create(nd, &path, flag, mode);
 		if (error)
 			goto exit;
-		/* Don't check for write permission, don't truncate */
-		acc_mode = 0;
-		flag &= ~O_TRUNC;
-		goto ok;
+		return 0;
 	}
 
 	/*
_

Patches currently in -mm which might be from haveblue@xxxxxxxxxx are

origin.patch
git-acpi.patch
ro-bind-mounts-r-o-bind-mount-prepwork-move-open_nameis-vfs_create.patch
ro-bind-mounts-add-vfsmount-writer-count.patch
ro-bind-mounts-elevate-mnt-writers-for-callers-of-vfs_mkdir.patch
ro-bind-mounts-elevate-write-count-during-entire-ncp_ioctl.patch
ro-bind-mounts-elevate-write-count-during-entire-ncp_ioctl-tidy.patch
ro-bind-mounts-sys_symlinkat-elevate-write-count-around-vfs_symlink.patch
ro-bind-mounts-elevate-mount-count-for-extended-attributes.patch
ro-bind-mounts-sys_linkat-elevate-write-count-around-vfs_link.patch
ro-bind-mounts-mount_is_safe-add-comment.patch
ro-bind-mounts-unix_find_other-elevate-write-count-for-touch_atime.patch
ro-bind-mounts-elevate-write-count-over-calls-to-vfs_rename.patch
ro-bind-mounts-tricky-elevate-write-count-files-are-opened.patch
ro-bind-mounts-elevate-writer-count-for-do_sys_truncate.patch
ro-bind-mounts-elevate-write-count-for-do_utimes.patch
ro-bind-mounts-elevate-write-count-for-do_sys_utime-and-touch_atime.patch
ro-bind-mounts-sys_mknodat-elevate-write-count-for-vfs_mknod-create.patch
ro-bind-mounts-elevate-mnt-writers-for-vfs_unlink-callers.patch
ro-bind-mounts-do_rmdir-elevate-write-count.patch
ro-bind-mounts-elevate-writer-count-for-custom-struct-file.patch
ro-bind-mounts-honor-r-w-changes-at-do_remount-time.patch
page-owner-tracking-leak-detector.patch
x86-e820-debugging.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux