From: Oleg Drokin <green@linuxhacker.ru>
To: neilb@cse.unsw.edu.au, linux-fsdevel@vger.kernel.org
Subject: Pass "allow owner override" flags from NFSD down to actual FS.
Date: Sat, 22 Apr 2006 23:29:35 +0300 [thread overview]
Message-ID: <20060422202935.GU22333@linuxhacker.ru> (raw)
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",
next reply other threads:[~2006-04-22 20:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-22 20:29 Oleg Drokin [this message]
2006-04-23 4:11 ` Pass "allow owner override" flags from NFSD down to actual FS Stephen Rothwell
2006-04-27 0:28 ` Neil Brown
2006-04-28 22:28 ` Oleg Drokin
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=20060422202935.GU22333@linuxhacker.ru \
--to=green@linuxhacker.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
/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).