aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSu Yanjun <suyanjun218@gmail.com>2019-12-25 11:37:57 +0800
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2020-01-15 10:54:33 -0500
commitfe1e8dbec11fcad3ae7a34e95fe483d4a2b018fc (patch)
tree97ddfcfee8598ec79a13cf5696a6e140656eb636
parentNFSv4.x recover from pre-mature loss of openstateid (diff)
downloadlinux-dev-fe1e8dbec11fcad3ae7a34e95fe483d4a2b018fc.tar.xz
linux-dev-fe1e8dbec11fcad3ae7a34e95fe483d4a2b018fc.zip
NFSv3: FIx bug when using chacl and chmod to change acl
We find a bug when running test under nfsv3  as below. 1) chacl u::r--,g::rwx,o:rw- file1 2) chmod u+w file1 3) chacl -l file1 We expect u::rw-, but it shows u::r--, more likely it returns the cached acl in inode. We dig the code find that the code path is different. chacl->..->__nfs3_proc_setacls->nfs_zap_acl_cache Then nfs_zap_acl_cache clears the NFS_INO_INVALID_ACL in NFS_I(inode)->cache_validity. chmod->..->nfs3_proc_setattr Because NFS_INO_INVALID_ACL has been cleared by chacl path, nfs_zap_acl_cache wont be called. nfs_setattr_update_inode will set NFS_INO_INVALID_ACL so let it before nfs_zap_acl_cache call. Signed-off-by: Su Yanjun <suyanjun218@gmail.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/nfs3proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 19f3d1b2807e..4c93a8bca7dc 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -145,9 +145,9 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
nfs_fattr_init(fattr);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
if (status == 0) {
+ nfs_setattr_update_inode(inode, sattr, fattr);
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;