]> err.no Git - linux-2.6/commitdiff
[PATCH] NFS: Fix up v3 ACL caching code
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 22 Jun 2005 17:16:27 +0000 (17:16 +0000)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 22 Jun 2005 20:07:26 +0000 (16:07 -0400)
 Initialize the inode cache values correctly.
 Clean up __nfs3_forget_cached_acls()

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/inode.c
fs/nfs/nfs3acl.c

index 50a03f1504a18d4ce7d0165478b665f1611077cb..8a8d57d9d6604a458d2243e9c373f9f8dd6ce6e0 100644 (file)
@@ -1961,6 +1961,10 @@ static struct inode *nfs_alloc_inode(struct super_block *sb)
        if (!nfsi)
                return NULL;
        nfsi->flags = 0;
+#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 */
index 451112ff9aa47cda581abb6f4c028a5ca4379f77..ee3536fc84a3bb49e7d99ab74b2ceffa162c6b89 100644 (file)
@@ -115,11 +115,11 @@ int nfs3_removexattr(struct dentry *dentry, const char *name)
 
 static void __nfs3_forget_cached_acls(struct nfs_inode *nfsi)
 {
-       if (nfsi->acl_access != ERR_PTR(-EAGAIN)) {
+       if (!IS_ERR(nfsi->acl_access)) {
                posix_acl_release(nfsi->acl_access);
                nfsi->acl_access = ERR_PTR(-EAGAIN);
        }
-       if (nfsi->acl_default != ERR_PTR(-EAGAIN)) {
+       if (!IS_ERR(nfsi->acl_default)) {
                posix_acl_release(nfsi->acl_default);
                nfsi->acl_default = ERR_PTR(-EAGAIN);
        }
@@ -137,7 +137,7 @@ void nfs3_forget_cached_acls(struct inode *inode)
 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(-EAGAIN);
+       struct posix_acl *acl = ERR_PTR(-EINVAL);
 
        spin_lock(&inode->i_lock);
        switch(type) {
@@ -150,12 +150,13 @@ static struct posix_acl *nfs3_get_cached_acl(struct inode *inode, int type)
                        break;
 
                default:
-                       return ERR_PTR(-EINVAL);
+                       goto out;
        }
-       if (acl == ERR_PTR(-EAGAIN))
+       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);