OSDN Git Service

NFSv3: FIx bug when using chacl and chmod to change acl
authorSu Yanjun <suyanjun218@gmail.com>
Wed, 25 Dec 2019 03:37:57 +0000 (11:37 +0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 15 Jan 2020 15:54:33 +0000 (10:54 -0500)
commitfe1e8dbec11fcad3ae7a34e95fe483d4a2b018fc
tree97ddfcfee8598ec79a13cf5696a6e140656eb636
parentd826e5b827641ae1bebb33d23a774f4e9bb8e94f
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>
fs/nfs/nfs3proc.c