Skip to content

Commit

Permalink
NFS: Send valid mode bits to the server
Browse files Browse the repository at this point in the history
 inode->i_mode contains a lot more than just the mode bits. Make sure that
 we mask away this extra stuff in SETATTR calls to the server.

 Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jan 6, 2006
1 parent f518e35 commit cf3fff5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/nfs/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
{
if (attr->ia_valid & ATTR_MODE) {
*p++ = xdr_one;
*p++ = htonl(attr->ia_mode);
*p++ = htonl(attr->ia_mode & S_IALLUGO);
} else {
*p++ = xdr_zero;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
}
if (iap->ia_valid & ATTR_MODE) {
bmval1 |= FATTR4_WORD1_MODE;
WRITE32(iap->ia_mode);
WRITE32(iap->ia_mode & S_IALLUGO);
}
if (iap->ia_valid & ATTR_UID) {
bmval1 |= FATTR4_WORD1_OWNER;
Expand Down
3 changes: 3 additions & 0 deletions fs/nfs/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
};
int status;

/* Mask out the non-modebit related stuff from attr->ia_mode */
sattr->ia_mode &= S_IALLUGO;

dprintk("NFS call setattr\n");
nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
Expand Down

0 comments on commit cf3fff5

Please sign in to comment.