linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: override uid and gid for exclusive creates in nfs3_proc_create
@ 2017-09-22 20:15 Scott Mayhew
  2017-09-22 21:18 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Mayhew @ 2017-09-22 20:15 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker; +Cc: linux-nfs

RFC 1813 section 3.3.8 states

      Once the client has performed a successful exclusive
      create, it must issue a SETATTR to set the correct file
      attributes.  Until it does so, it should not rely upon any
      of the file attributes, since the server implementation
      may need to overload file metadata to store the verifier.

HP-UX expects the client to send the uid and gid in the post-create
setattr for exclusive creates.  Customers are sometimes seeing bogus
values because the Linux NFS client is only updating the atime and
mtime.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 fs/nfs/nfs3proc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index d1e87ec..4d77d2d 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -370,6 +370,13 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
 	if (data->arg.create.createmode == NFS3_CREATE_EXCLUSIVE) {
 		dprintk("NFS call  setattr (post-create)\n");
 
+		sattr->ia_uid = current_fsuid();
+		sattr->ia_valid |= ATTR_UID;
+		if (dir->i_mode & S_ISGID)
+			sattr->ia_gid = dir->i_gid;
+		else
+			sattr->ia_gid = current_fsgid();
+		sattr->ia_valid |= ATTR_GID;
 		if (!(sattr->ia_valid & ATTR_ATIME_SET))
 			sattr->ia_valid |= ATTR_ATIME;
 		if (!(sattr->ia_valid & ATTR_MTIME_SET))
-- 
2.9.5


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

end of thread, other threads:[~2017-09-22 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22 20:15 [PATCH] nfs: override uid and gid for exclusive creates in nfs3_proc_create Scott Mayhew
2017-09-22 21:18 ` Trond Myklebust

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