Skip to contentSkip to conversation

nfsv3: Use inode posix acl cache

PATCH In review Aneesh Kumar K.V 2 participants 4 messages Sep 2, 2009 – Sep 15, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsv3: Use inode posix acl cache

This patch update nfs3 acl caching to use struct inode acl cache.

---
 fs/nfs/inode.c         |    4 --
 fs/nfs/nfs3acl.c       |   82 +++++++++---------------------------------------
 include/linux/nfs_fs.h |    4 --
 3 files changed, 15 insertions(+), 75 deletions(-)
fs/nfs/inode.c +0 -4
index bd7938e..714ed5e 100644
@@ -1346,10 +1346,6 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
 		return NULL;
 	nfsi->flags = 0UL;
 	nfsi->cache_validity = 0UL;
-#ifdef CONFIG_NFS_V3_ACL
-	nfsi->acl_access = ERR_PTR(-EAGAIN);
-	nfsi->acl_default = ERR_PTR(-EAGAIN);
-#endif
 #ifdef CONFIG_NFS_V4
 	nfsi->nfs4_acl = NULL;
 #endif /* CONFIG_NFS_V4 */
fs/nfs/nfs3acl.c +15 -67

109 lines not on this page · raw message

include/linux/nfs_fs.h +0 -4
index f6b9024..738758f 100644
@@ -150,10 +150,6 @@ struct nfs_inode {
 	struct rb_root		access_cache;
 	struct list_head	access_cache_entry_lru;
 	struct list_head	access_cache_inode_lru;
-#ifdef CONFIG_NFS_V3_ACL
-	struct posix_acl	*acl_access;
-	struct posix_acl	*acl_default;
-#endif
 
 	/*
 	 * This is the cookie verifier used for NFSv3 readdir
Signature · 1 line
1.6.4.2.253.g0b1fac
#1 lore raw

Any chance of getting this patch applied ?

-aneesh

Quoted 159 lines · Aneesh Kumar K.V

This patch update nfs3 acl caching to use struct inode acl cache.

---
 fs/nfs/inode.c         |    4 --
 fs/nfs/nfs3acl.c       |   82 +++++++++---------------------------------------
 include/linux/nfs_fs.h |    4 --
 3 files changed, 15 insertions(+), 75 deletions(-)
fs/nfs/inode.c +0 -4
index bd7938e..714ed5e 100644
@@ -1346,10 +1346,6 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
 		return NULL;
 	nfsi->flags = 0UL;
 	nfsi->cache_validity = 0UL;
-#ifdef CONFIG_NFS_V3_ACL
-	nfsi->acl_access = ERR_PTR(-EAGAIN);
-	nfsi->acl_default = ERR_PTR(-EAGAIN);
-#endif
 #ifdef CONFIG_NFS_V4
 	nfsi->nfs4_acl = NULL;
 #endif /* CONFIG_NFS_V4 */
fs/nfs/nfs3acl.c +15 -67
index bac6051..8271b3c 100644
@@ -115,70 +115,13 @@ int nfs3_removexattr(struct dentry *dentry, const char *name)
 	return nfs3_proc_setacl(inode, type, NULL);
 }
 
-static void __nfs3_forget_cached_acls(struct nfs_inode *nfsi)
-{
-	if (!IS_ERR(nfsi->acl_access)) {
-		posix_acl_release(nfsi->acl_access);
-		nfsi->acl_access = ERR_PTR(-EAGAIN);
-	}
-	if (!IS_ERR(nfsi->acl_default)) {
-		posix_acl_release(nfsi->acl_default);
-		nfsi->acl_default = ERR_PTR(-EAGAIN);
-	}
-}
-
 void nfs3_forget_cached_acls(struct inode *inode)
 {
-	dprintk("NFS: nfs3_forget_cached_acls(%s/%ld)\n", inode->i_sb->s_id,
-		inode->i_ino);
-	spin_lock(&inode->i_lock);
-	__nfs3_forget_cached_acls(NFS_I(inode));
-	spin_unlock(&inode->i_lock);
-}
+       dprintk("NFS: nfs3_forget_cached_acls(%s/%ld)\n", inode->i_sb->s_id,
+	       inode->i_ino);
+       forget_cached_acl(inode, ACL_TYPE_DEFAULT);
+       forget_cached_acl(inode, ACL_TYPE_ACCESS);
 
-static struct posix_acl *nfs3_get_cached_acl(struct inode *inode, int type)
-{
-	struct nfs_inode *nfsi = NFS_I(inode);
-	struct posix_acl *acl = ERR_PTR(-EINVAL);
-
-	spin_lock(&inode->i_lock);
-	switch(type) {
-		case ACL_TYPE_ACCESS:
-			acl = nfsi->acl_access;
-			break;
-
-		case ACL_TYPE_DEFAULT:
-			acl = nfsi->acl_default;
-			break;
-
-		default:
-			goto out;
-	}
-	if (IS_ERR(acl))
-		acl = ERR_PTR(-EAGAIN);
-	else
-		acl = posix_acl_dup(acl);
-out:
-	spin_unlock(&inode->i_lock);
-	dprintk("NFS: nfs3_get_cached_acl(%s/%ld, %d) = %p\n", inode->i_sb->s_id,
-		inode->i_ino, type, acl);
-	return acl;
-}
-
-static void nfs3_cache_acls(struct inode *inode, struct posix_acl *acl,
-		    struct posix_acl *dfacl)
-{
-	struct nfs_inode *nfsi = NFS_I(inode);
-
-	dprintk("nfs3_cache_acls(%s/%ld, %p, %p)\n", inode->i_sb->s_id,
-		inode->i_ino, acl, dfacl);
-	spin_lock(&inode->i_lock);
-	__nfs3_forget_cached_acls(NFS_I(inode));
-	if (!IS_ERR(acl))
-		nfsi->acl_access = posix_acl_dup(acl);
-	if (!IS_ERR(dfacl))
-		nfsi->acl_default = posix_acl_dup(dfacl);
-	spin_unlock(&inode->i_lock);
 }
 
 struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
@@ -207,8 +150,8 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
 	status = nfs_revalidate_inode(server, inode);
 	if (status < 0)
 		return ERR_PTR(status);
-	acl = nfs3_get_cached_acl(inode, type);
-	if (acl != ERR_PTR(-EAGAIN))
+	acl = get_cached_acl(inode, type);
+	if (acl != ACL_NOT_CACHED)
 		return acl;
 	acl = NULL;
 
@@ -259,9 +202,11 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type)
 			res.acl_access = NULL;
 		}
 	}
-	nfs3_cache_acls(inode,
-		(res.mask & NFS_ACL)   ? res.acl_access  : ERR_PTR(-EINVAL),
-		(res.mask & NFS_DFACL) ? res.acl_default : ERR_PTR(-EINVAL));
+
+	if (res.mask & NFS_ACL)
+		set_cached_acl(inode, type, res.acl_access);
+	if (res.mask & NFS_DFACL)
+		set_cached_acl(inode, type, res.acl_default);
 
 	switch(type) {
 		case ACL_TYPE_ACCESS:
@@ -344,7 +289,10 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
 	switch (status) {
 		case 0:
 			status = nfs_refresh_inode(inode, &fattr);
-			nfs3_cache_acls(inode, acl, dfacl);
+			if (!IS_ERR(dfacl))
+				set_cached_acl(inode, ACL_TYPE_DEFAULT, dfacl);
+			if (!IS_ERR(acl))
+				set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
 			break;
 		case -EPFNOSUPPORT:
 		case -EPROTONOSUPPORT:
include/linux/nfs_fs.h +0 -4
index f6b9024..738758f 100644
@@ -150,10 +150,6 @@ struct nfs_inode {
 	struct rb_root		access_cache;
 	struct list_head	access_cache_entry_lru;
 	struct list_head	access_cache_inode_lru;
-#ifdef CONFIG_NFS_V3_ACL
-	struct posix_acl	*acl_access;
-	struct posix_acl	*acl_default;
-#endif
 
 	/*
 	 * This is the cookie verifier used for NFSv3 readdir
Signature · 1 line
1.6.4.2.253.g0b1fac

A message that is not in the archive (sent off-list or not yet received): 20090915083740.GA7884-6yE53ggjAfyuJw1Jpgb2kA4V1jybR7bhVpNB7YpNyf8@public.gmane.org

#3 lore raw
Quoted 3 lines · Aneesh Kumar K.V

Any chance of getting this patch applied ?

-aneesh

AFAICS, it adds a dependency on CONFIG_FS_POSIX_ACL that needs to be resolved in Kconfig first.

Has it been tested, and if so what were the tests?

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com

A message that is not in the archive (sent off-list or not yet received): 1253021706.4456.5.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#5 lore raw
Quoted 10 lines · Trond Myklebust
Quoted 3 lines · Aneesh Kumar K.V

Any chance of getting this patch applied ?

-aneesh

AFAICS, it adds a dependency on CONFIG_FS_POSIX_ACL that needs to be resolved in Kconfig first.

Has it been tested, and if so what were the tests?

I did a getfacl and setfacl test with two clients. If there is a test suite that i need to run to get the patches tested please let me. I will add the proper Kconfig dependency and sent a revised patch later.

-aneesh