linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: agruen@kernel.org, bfields@fieldses.org,
	akpm@linux-foundation.org, viro@zeniv.linux.org.uk,
	dhowells@redhat.com
Cc: aneesh.kumar@linux.vnet.ibm.com, linux-fsdevel@vger.kernel.org,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH -V8 05/26] vfs: Add generic IS_ACL() test for acl support
Date: Sun, 23 Oct 2011 23:13:34 +0530	[thread overview]
Message-ID: <1319391835-5829-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1319391835-5829-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

From: Andreas Gruenbacher <agruen@kernel.org>

When IS_POSIXACL() is true, the vfs does not apply the umask.  Other acl
models will need the same exception, so introduce a separate IS_ACL()
test.

The IS_POSIX_ACL() test is still needed so that nfsd can determine when
the underlying file system supports POSIX ACLs (as opposed to some other
kind).

Acked-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruen@kernel.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/namei.c         |    6 +++---
 include/linux/fs.h |    8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 9061157..cf8b2f0 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2166,7 +2166,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
 	/* Negative dentry, just create the file */
 	if (!dentry->d_inode) {
 		int mode = op->mode;
-		if (!IS_POSIXACL(dir->d_inode))
+		if (!IS_ACL(dir->d_inode))
 			mode &= ~current_umask();
 		/*
 		 * This write is needed to ensure that a
@@ -2484,7 +2484,7 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 
-	if (!IS_POSIXACL(path.dentry->d_inode))
+	if (!IS_ACL(path.dentry->d_inode))
 		mode &= ~current_umask();
 	error = may_mknod(mode);
 	if (error)
@@ -2553,7 +2553,7 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
 	if (IS_ERR(dentry))
 		return PTR_ERR(dentry);
 
-	if (!IS_POSIXACL(path.dentry->d_inode))
+	if (!IS_ACL(path.dentry->d_inode))
 		mode &= ~current_umask();
 	error = mnt_want_write(path.mnt);
 	if (error)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c1884e9..1994b84 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -201,7 +201,7 @@ struct inodes_stat_t {
 #define MS_VERBOSE	32768	/* War is peace. Verbosity is silence.
 				   MS_VERBOSE is deprecated. */
 #define MS_SILENT	32768
-#define MS_POSIXACL	(1<<16)	/* VFS does not apply the umask */
+#define MS_POSIXACL	(1<<16) /* Supports POSIX ACLs */
 #define MS_UNBINDABLE	(1<<17)	/* change to unbindable */
 #define MS_PRIVATE	(1<<18)	/* change to private */
 #define MS_SLAVE	(1<<19)	/* change to slave */
@@ -279,6 +279,12 @@ struct inodes_stat_t {
 #define IS_AUTOMOUNT(inode)	((inode)->i_flags & S_AUTOMOUNT)
 #define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)
 
+/*
+ * IS_ACL() tells the VFS to not apply the umask
+ * and use check_acl for acl permission checks when defined.
+ */
+#define IS_ACL(inode)		__IS_FLG(inode, MS_POSIXACL)
+
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */
 
-- 
1.7.5.4

  parent reply	other threads:[~2011-10-23 17:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 17:43 [PATCH -V8 00/26] New ACL format for better NFSv4 acl interoperability Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 01/26] vfs: Indicate that the permission functions take all the MAY_* flags Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 02/26] vfs: Add hex format for MAY_* flag values Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 03/26] vfs: Pass all mask flags down to iop->check_acl Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 04/26] vfs: Add a comment to inode_permission() Aneesh Kumar K.V
2011-10-23 17:43 ` Aneesh Kumar K.V [this message]
2011-10-23 17:43 ` [PATCH -V8 06/26] vfs: Add IS_RICHACL() test for richacl support Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 07/26] vfs: Optimize out IS_RICHACL() if CONFIG_FS_RICHACL is not defined Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 08/26] vfs: Add new file and directory create permission flags Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 09/26] vfs: Add delete child and delete self " Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 10/26] vfs: Make the inode passed to inode_change_ok non-const Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 11/26] vfs: Add permission flags for setting file attributes Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 12/26] vfs: Make acl_permission_check() work for richacls Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 13/26] richacl: In-memory representation and helper functions Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 14/26] richacl: Permission mapping functions Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 15/26] richacl: Compute maximum file masks from an acl Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 16/26] richacl: Update the file masks in chmod() Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 17/26] richacl: Permission check algorithm Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 18/26] richacl: Create-time inheritance Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 19/26] richacl: Check if an acl is equivalent to a file mode Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 20/26] richacl: Automatic Inheritance Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 21/26] richacl: xattr mapping functions Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 22/26] vfs: Cache richacl in struct inode Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 23/26] vfs: Add richacl permission check Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 24/26] ext4: Use IS_POSIXACL() to check for POSIX ACL support Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 25/26] ext4: Implement rich acl for ext4 Aneesh Kumar K.V
2011-10-23 17:43 ` [PATCH -V8 26/26] ext4: Add Ext4 compat richacl feature flag Aneesh Kumar K.V
     [not found] ` <1319391835-5829-1-git-send-email-aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2011-10-24  9:17   ` [PATCH -V8 00/26] New ACL format for better NFSv4 acl interoperability J. Bruce Fields
     [not found]     ` <20111024091716.GA1109-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-10-24  9:49       ` Christoph Hellwig
     [not found]         ` <20111024094910.GA28693-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2011-10-24 11:07           ` J. Bruce Fields
     [not found]             ` <20111024110759.GA1863-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-10-25 13:30               ` J. Bruce Fields
2011-10-24 11:35         ` Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319391835-5829-6-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=agruen@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).