diff mbox

[v2] NFSv3/acl: forget acl cache after setattr

Message ID 2a720d30-6471-5352-56a3-3d615bff5352@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

chenditang March 29, 2018, 6:01 a.m. UTC
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>
---
 fs/nfs/nfs3proc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kinglong Mee March 29, 2018, 6:47 a.m. UTC | #1
On 2018/3/29 14:01, chendt wrote:
> 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>
> ---
>  fs/nfs/nfs3proc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
> index 7327930..fcb0c40 100644
> --- a/fs/nfs/nfs3proc.c
> +++ b/fs/nfs/nfs3proc.c
> @@ -139,6 +139,8 @@
>  	nfs_fattr_init(fattr);
>  	status = rpc_call_sync(NFS_CLIENT(inode), &msg, 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);

Missing { } after if (status == 0) ?

thanks,
Kinglong Mee

>  	dprintk("NFS reply setattr: %d\n", status);
>  	return status;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 7327930..fcb0c40 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -139,6 +139,8 @@ 
 	nfs_fattr_init(fattr);
 	status = rpc_call_sync(NFS_CLIENT(inode), &msg, 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;