linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Pass "allow owner override" flags from NFSD down to actual FS.
@ 2006-04-22 20:29 Oleg Drokin
  2006-04-23  4:11 ` Stephen Rothwell
  2006-04-27  0:28 ` Neil Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Drokin @ 2006-04-22 20:29 UTC (permalink / raw)
  To: neilb, linux-fsdevel

Hello!

   NFSD does its own internal checks to possibly override restrictive file mode
   for file owner already, to allow writing into (opened) file with some
   restrictive mode (like 0000). But it does not pass this info down to
   actual filesystems, and if that filesystem is also doing permission checks
   in open, such an open would fail at FS-level.
   (I thought of making an example with NFS exported with NFS, but this appears
    to be not allowed, so I choose different example).
   For example Lustre is contacting its metadata server for every open, and
   metadata server does permission checks for open, obviously.

   I wonder if something like the patch below can be useful for any other
   distributed FS now in use and ultimately to end up accepted into vanilla
   tree?


--- linux-2.6.16/include/asm-generic/fcntl.h.orig	2006-04-22 23:09:57.000000000 +0300
+++ linux-2.6.16/include/asm-generic/fcntl.h	2006-04-22 23:10:58.000000000 +0300
@@ -52,6 +52,9 @@
 #ifndef O_NDELAY
 #define O_NDELAY	O_NONBLOCK
 #endif
+#ifndef O_OWNER_OVERRIDE
+#define O_OWNER_OVERRIDE 02000000
+#endif
 
 #define F_DUPFD		0	/* dup */
 #define F_GETFD		1	/* get close_on_exec */
--- linux-2.6.16/include/linux/fs.h.orig	2006-04-22 23:02:22.000000000 +0300
+++ linux-2.6.16/include/linux/fs.h	2006-04-22 23:06:22.000000000 +0300
@@ -265,6 +265,7 @@ typedef void (dio_iodone_t)(struct kiocb
 #define ATTR_KILL_SUID	2048
 #define ATTR_KILL_SGID	4096
 #define ATTR_FILE	8192
+#define ATTR_OWNER_OVERRIDE	16384
 
 /*
  * This is the Inode Attributes structure, used for notify_change().  It
--- linux-2.6.16/fs/nfsd/vfs.c.orig	2006-04-22 23:03:49.000000000 +0300
+++ linux-2.6.16/fs/nfsd/vfs.c	2006-04-22 23:11:34.000000000 +0300
@@ -341,9 +341,10 @@ nfsd_setattr(struct svc_rqst *rqstp, str
 	if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
 		iap->ia_valid |= ATTR_KILL_SGID;
 
-	/* Change the attributes. */
+	/* Change the attributes. Allow owner of file to change attributes
+	 * even if mode does not permit so. */
 
-	iap->ia_valid |= ATTR_CTIME;
+	iap->ia_valid |= ATTR_CTIME | ATTR_OWNER_OVERRIDE;
 
 	err = nfserr_notsync;
 	if (!check_guard || guardtime == inode->i_ctime.tv_sec) {
@@ -640,7 +641,7 @@ nfsd_open(struct svc_rqst *rqstp, struct
 {
 	struct dentry	*dentry;
 	struct inode	*inode;
-	int		flags = O_RDONLY|O_LARGEFILE, err;
+	int		flags = O_RDONLY|O_LARGEFILE|O_OWNER_OVERRIDE, err;
 
 	/*
 	 * If we get here, then the client has already done an "open",

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-28 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-22 20:29 Pass "allow owner override" flags from NFSD down to actual FS Oleg Drokin
2006-04-23  4:11 ` Stephen Rothwell
2006-04-27  0:28 ` Neil Brown
2006-04-28 22:28   ` Oleg Drokin

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).