+ r-o-bind-mount-prepwork-move-open_nameis-vfs_create.patch added to -mm tree

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

 



The patch titled

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

has been added to the -mm tree.  Its filename is

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

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: 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.

Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
Acked-by: Christoph Hellwig <hch@xxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

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

diff -puN fs/namei.c~r-o-bind-mount-prepwork-move-open_nameis-vfs_create fs/namei.c
--- a/fs/namei.c~r-o-bind-mount-prepwork-move-open_nameis-vfs_create
+++ a/fs/namei.c
@@ -1587,6 +1587,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()
  *
@@ -1668,18 +1686,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

sys_getppid-oopses-on-debug-kernel-v2.patch
bootmem-remove-useless-__init-in-header-file.patch
bootmem-mark-link_bootmem-as-part-of-the-__init-section.patch
bootmem-remove-useless-parentheses-in-bootmem-header.patch
bootmem-limit-to-80-columns-width.patch
bootmem-remove-useless-headers-inclusions.patch
bootmem-use-pfn-page-conversion-macros.patch
bootmem-miscellaneous-coding-style-fixes.patch
avr32-kill-config_discontigmem-support-completely.patch
x86-enable-vmsplit-for-highmem-kernels.patch
kthread-drivers-base-firmware_classc.patch
pidspace-is_init.patch
fs-cache-make-kafs-use-fs-cache-fix.patch
r-o-bind-mount-prepare-for-write-access-checks-collapse-if.patch
r-o-bind-mount-prepwork-move-open_nameis-vfs_create.patch
r-o-bind-mount-unlink-monitor-i_nlink.patch
r-o-bind-mount-prepwork-inc_nlink-helper.patch
r-o-bind-mount-clean-up-ocfs2-nlink-handling.patch
r-o-bind-mount-monitor-zeroing-of-i_nlink.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