linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: Discard ACL cache on mode update
@ 2010-12-01 10:42 Aneesh Kumar K.V
  2010-12-07 22:34 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2010-12-01 10:42 UTC (permalink / raw)
  To: trond.myklebust, bfields; +Cc: linux-nfs, Aneesh Kumar K.V

An update of mode bits can result in ACL value being changed. We need
to mark the acl cache invalid when we update mode. Similarly we need
to update file attribute when we change ACL value

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fs/nfs/nfs4proc.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 821d4c7..89fb751 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3356,6 +3356,8 @@ ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen)
 	ret = nfs_revalidate_inode(server, inode);
 	if (ret < 0)
 		return ret;
+	if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL)
+		nfs_zap_acl_cache(inode);
 	ret = nfs4_read_cached_acl(inode, buf, buflen);
 	if (ret != -ENOENT)
 		return ret;
@@ -3384,6 +3386,13 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
 	nfs_inode_return_delegation(inode);
 	buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
 	ret = nfs4_call_sync(server, &msg, &arg, &res, 1);
+	/*
+	 * Acl update can result in inode attribute update.
+	 * so mark the attribute cache invalid.
+	 */
+	spin_lock(&inode->i_lock);
+	NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
+	spin_unlock(&inode->i_lock);
 	nfs_access_zap_cache(inode);
 	nfs_zap_acl_cache(inode);
 	return ret;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfs: Discard ACL cache on mode update
  2010-12-01 10:42 [PATCH] nfs: Discard ACL cache on mode update Aneesh Kumar K.V
@ 2010-12-07 22:34 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2010-12-07 22:34 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: bfields, linux-nfs

On Wed, 2010-12-01 at 16:12 +0530, Aneesh Kumar K.V wrote:
> An update of mode bits can result in ACL value being changed. We need
> to mark the acl cache invalid when we update mode. Similarly we need
> to update file attribute when we change ACL value
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  fs/nfs/nfs4proc.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 821d4c7..89fb751 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3356,6 +3356,8 @@ ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen)
>  	ret = nfs_revalidate_inode(server, inode);
>  	if (ret < 0)
>  		return ret;
> +	if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL)
> +		nfs_zap_acl_cache(inode);
>  	ret = nfs4_read_cached_acl(inode, buf, buflen);
>  	if (ret != -ENOENT)
>  		return ret;
> @@ -3384,6 +3386,13 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
>  	nfs_inode_return_delegation(inode);
>  	buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
>  	ret = nfs4_call_sync(server, &msg, &arg, &res, 1);
> +	/*
> +	 * Acl update can result in inode attribute update.
> +	 * so mark the attribute cache invalid.
> +	 */
> +	spin_lock(&inode->i_lock);
> +	NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR;
> +	spin_unlock(&inode->i_lock);
>  	nfs_access_zap_cache(inode);
>  	nfs_zap_acl_cache(inode);
>  	return ret;

Thanks! Applied...

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-07 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-01 10:42 [PATCH] nfs: Discard ACL cache on mode update Aneesh Kumar K.V
2010-12-07 22:34 ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).