Commit cf3fff54a46e1f8fa4cc1deb783172a392077eb0

Authored by Trond Myklebust
1 parent f518e35aec

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: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 3 changed files with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -182,7 +182,7 @@
182 182 {
183 183 if (attr->ia_valid & ATTR_MODE) {
184 184 *p++ = xdr_one;
185   - *p++ = htonl(attr->ia_mode);
  185 + *p++ = htonl(attr->ia_mode & S_IALLUGO);
186 186 } else {
187 187 *p++ = xdr_zero;
188 188 }
... ... @@ -566,7 +566,7 @@
566 566 }
567 567 if (iap->ia_valid & ATTR_MODE) {
568 568 bmval1 |= FATTR4_WORD1_MODE;
569   - WRITE32(iap->ia_mode);
  569 + WRITE32(iap->ia_mode & S_IALLUGO);
570 570 }
571 571 if (iap->ia_valid & ATTR_UID) {
572 572 bmval1 |= FATTR4_WORD1_OWNER;
... ... @@ -111,6 +111,9 @@
111 111 };
112 112 int status;
113 113  
  114 + /* Mask out the non-modebit related stuff from attr->ia_mode */
  115 + sattr->ia_mode &= S_IALLUGO;
  116 +
114 117 dprintk("NFS call setattr\n");
115 118 nfs_fattr_init(fattr);
116 119 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);