mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: linux-kernel@vger.kernel.org
Subject: [patch 1/3] Pass MAY_APPEND through to permission inode operations that understand it
Date: Wed, 06 Sep 2006 17:14:39 +0200	[thread overview]
Message-ID: <20060906151644.601351848@winden.suse.de> (raw)
In-Reply-To: <20060906151438.228071937@winden.suse.de>

[-- Attachment #1: may-append.diff --]
[-- Type: text/plain, Size: 2166 bytes --]

Introduce a mount flag with which filesystems can idicate that they
support permissions beyond MAY_READ, MAY_WRITE, and MAY_EXEC. If
that flag is set, pass MAY_APPEND through to the filesystems'
permission inode operation.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>

Index: linux-2.6.18-rc6/fs/namei.c
===================================================================
--- linux-2.6.18-rc6.orig/fs/namei.c
+++ linux-2.6.18-rc6/fs/namei.c
@@ -228,7 +228,7 @@ int generic_permission(struct inode *ino
 int permission(struct inode *inode, int mask, struct nameidata *nd)
 {
 	umode_t mode = inode->i_mode;
-	int retval, submask;
+	int retval, submask = mask;
 
 	if (mask & MAY_WRITE) {
 
@@ -254,8 +254,8 @@ int permission(struct inode *inode, int 
 	if ((mask & MAY_EXEC) && S_ISREG(mode) && !(mode & S_IXUGO))
 		return -EACCES;
 
-	/* Ordinary permission routines do not understand MAY_APPEND. */
-	submask = mask & ~MAY_APPEND;
+	if (!IS_XPERM(inode))
+		submask &= (MAY_READ | MAY_WRITE | MAY_EXEC);
 	if (inode->i_op && inode->i_op->permission)
 		retval = inode->i_op->permission(inode, submask, nd);
 	else
Index: linux-2.6.18-rc6/include/linux/fs.h
===================================================================
--- linux-2.6.18-rc6.orig/include/linux/fs.h
+++ linux-2.6.18-rc6/include/linux/fs.h
@@ -119,6 +119,8 @@ extern int dir_notify_enable;
 #define MS_PRIVATE	(1<<18)	/* change to private */
 #define MS_SLAVE	(1<<19)	/* change to slave */
 #define MS_SHARED	(1<<20)	/* change to shared */
+#define MS_XPERM	(1<<21) /* permission function understands more than
+				   MAY_{READ,WRITE,EXEC} */
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
 
@@ -172,6 +174,7 @@ extern int dir_notify_enable;
 #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
 #define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE)
 #define IS_POSIXACL(inode)	__IS_FLG(inode, MS_POSIXACL)
+#define IS_XPERM(inode)		__IS_FLG(inode, MS_XPERM)
 
 #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD)
 #define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME)

--
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX Products GmbH / Novell Inc.


  reply	other threads:[~2006-09-06 14:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 15:14 [patch 0/3] [RFC] NFSv4 ACLs on ext3 Andreas Gruenbacher
2006-09-06 15:14 ` Andreas Gruenbacher [this message]
2006-09-06 15:14 ` [patch 2/3] Add match_string() for mount option parsing Andreas Gruenbacher
2006-09-06 15:14 ` [patch 3/3] NFSv4 ACLs on ext3 Andreas Gruenbacher

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=20060906151644.601351848@winden.suse.de \
    --to=agruen@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®