aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-08-16 11:49:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-16 12:30:58 -0400
commit65e4308d2500e7daf60c3dccc202c61ffb066c63 (patch)
tree76a2e00004f645d09b2e59b485fb2aea0af45234 /fs/nfs/nfs3proc.c
parent367ae3cd74bdc2ad32d71293427fec570b14ddcd (diff)
[PATCH] NFS: Ensure we always update inode->i_mode when doing O_EXCL creates
When the client performs an exclusive create and opens the file for writing, a Netapp filer will first create the file using the mode 01777. It does this since an NFSv3/v4 exclusive create cannot immediately set the mode bits. The 01777 mode then gets put into the inode->i_mode. After the file creation is successful, we then do a setattr to change the mode to the correct value (as per the NFS spec). The problem is that nfs_refresh_inode() no longer updates inode->i_mode, so the latter retains the 01777 mode. A bit later, the VFS notices this, and calls remove_suid(). This of course now resets the file mode to inode->i_mode & 0777. Hey presto, the file mode on the server is now magically changed to 0777. Duh... Fixes http://bugzilla.linux-nfs.org/show_bug.cgi?id=32 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfs/nfs3proc.c')
-rw-r--r--fs/nfs/nfs3proc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 7851569b31c6..2681485cf2d0 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -120,6 +120,8 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
120 dprintk("NFS call setattr\n"); 120 dprintk("NFS call setattr\n");
121 fattr->valid = 0; 121 fattr->valid = 0;
122 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); 122 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0);
123 if (status == 0)
124 nfs_setattr_update_inode(inode, sattr);
123 dprintk("NFS reply setattr: %d\n", status); 125 dprintk("NFS reply setattr: %d\n", status);
124 return status; 126 return status;
125} 127}
@@ -370,6 +372,8 @@ again:
370 * not sure this buys us anything (and I'd have 372 * not sure this buys us anything (and I'd have
371 * to revamp the NFSv3 XDR code) */ 373 * to revamp the NFSv3 XDR code) */
372 status = nfs3_proc_setattr(dentry, &fattr, sattr); 374 status = nfs3_proc_setattr(dentry, &fattr, sattr);
375 if (status == 0)
376 nfs_setattr_update_inode(dentry->d_inode, sattr);
373 nfs_refresh_inode(dentry->d_inode, &fattr); 377 nfs_refresh_inode(dentry->d_inode, &fattr);
374 dprintk("NFS reply setattr (post-create): %d\n", status); 378 dprintk("NFS reply setattr (post-create): %d\n", status);
375 } 379 }