Commit cf3fff54 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Send valid mode bits to the server

 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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent f518e35a
...@@ -182,7 +182,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr) ...@@ -182,7 +182,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr)
{ {
if (attr->ia_valid & ATTR_MODE) { if (attr->ia_valid & ATTR_MODE) {
*p++ = xdr_one; *p++ = xdr_one;
*p++ = htonl(attr->ia_mode); *p++ = htonl(attr->ia_mode & S_IALLUGO);
} else { } else {
*p++ = xdr_zero; *p++ = xdr_zero;
} }
......
...@@ -566,7 +566,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s ...@@ -566,7 +566,7 @@ static int encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const s
} }
if (iap->ia_valid & ATTR_MODE) { if (iap->ia_valid & ATTR_MODE) {
bmval1 |= FATTR4_WORD1_MODE; bmval1 |= FATTR4_WORD1_MODE;
WRITE32(iap->ia_mode); WRITE32(iap->ia_mode & S_IALLUGO);
} }
if (iap->ia_valid & ATTR_UID) { if (iap->ia_valid & ATTR_UID) {
bmval1 |= FATTR4_WORD1_OWNER; bmval1 |= FATTR4_WORD1_OWNER;
......
...@@ -111,6 +111,9 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, ...@@ -111,6 +111,9 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
}; };
int status; int status;
/* Mask out the non-modebit related stuff from attr->ia_mode */
sattr->ia_mode &= S_IALLUGO;
dprintk("NFS call setattr\n"); dprintk("NFS call setattr\n");
nfs_fattr_init(fattr); nfs_fattr_init(fattr);
status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment