[PATCH] nfs: override uid and gid for exclusive creates in nfs3_proc_create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux