NFSv3/acl: forget acl cache after setattr
authorchendt <chendt.fnst@cn.fujitsu.com>
Thu, 29 Mar 2018 08:13:09 +0000 (16:13 +0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 10 Apr 2018 20:06:22 +0000 (16:06 -0400)
Sync of ACL with std permissions fail,We need to forget the ACL cache after setattr.

Reproduction:
#!/bin/bash
touch testfile
cat <<EOF >testfile
#!/bin/bash
echo "Test was executed"
EOF
chmod u=rwx testfile
chmod g=rw- testfile
chmod o=r-- testfile

chacl u::r--,g::rwx,o:rw- testfile
chmod u+w testfile
ls -l testfile
chacl -l testfile

Output:
-rw-rwxrw- 1 root root 0 Mar 28 05:29 testfile
testfile [u::r--,g::rwx,o::rw-]

Signed-off-by: chendt.fnst <chendt.fnst@cn.fujitsu.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Kinglong Mee <Kinglong Mee>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs3proc.c

index cc04d988db7c4585eee965fb7755a89c2746fdd4..eadf1ab31d1666c7ce462b56d8f00ae80de7650a 100644 (file)
@@ -138,8 +138,11 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
                msg.rpc_cred = nfs_file_cred(sattr->ia_file);
        nfs_fattr_init(fattr);
        status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
-       if (status == 0)
+       if (status == 0) {
+               if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL)
+                       nfs_zap_acl_cache(inode);
                nfs_setattr_update_inode(inode, sattr, fattr);
+       }
        dprintk("NFS reply setattr: %d\n", status);
        return status;
 }