diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 13:16:27 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-06-22 16:07:26 -0400 |
commit | 458818ed76d3f495f9f32373c936456c9427f759 (patch) | |
tree | cf280ec14954d61fea2f171eaa198196fe5a1e56 | |
parent | 5c6a9f7d92291c832d47e792ed1fafa44acb066e (diff) |
[PATCH] NFS: Fix up v3 ACL caching code
Initialize the inode cache values correctly.
Clean up __nfs3_forget_cached_acls()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs3acl.c | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 50a03f1504a1..8a8d57d9d660 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1961,6 +1961,10 @@ static struct inode *nfs_alloc_inode(struct super_block *sb) | |||
1961 | if (!nfsi) | 1961 | if (!nfsi) |
1962 | return NULL; | 1962 | return NULL; |
1963 | nfsi->flags = 0; | 1963 | nfsi->flags = 0; |
1964 | #ifdef CONFIG_NFS_V3_ACL | ||
1965 | nfsi->acl_access = ERR_PTR(-EAGAIN); | ||
1966 | nfsi->acl_default = ERR_PTR(-EAGAIN); | ||
1967 | #endif | ||
1964 | #ifdef CONFIG_NFS_V4 | 1968 | #ifdef CONFIG_NFS_V4 |
1965 | nfsi->nfs4_acl = NULL; | 1969 | nfsi->nfs4_acl = NULL; |
1966 | #endif /* CONFIG_NFS_V4 */ | 1970 | #endif /* CONFIG_NFS_V4 */ |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 451112ff9aa4..ee3536fc84a3 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -115,11 +115,11 @@ int nfs3_removexattr(struct dentry *dentry, const char *name) | |||
115 | 115 | ||
116 | static void __nfs3_forget_cached_acls(struct nfs_inode *nfsi) | 116 | static void __nfs3_forget_cached_acls(struct nfs_inode *nfsi) |
117 | { | 117 | { |
118 | if (nfsi->acl_access != ERR_PTR(-EAGAIN)) { | 118 | if (!IS_ERR(nfsi->acl_access)) { |
119 | posix_acl_release(nfsi->acl_access); | 119 | posix_acl_release(nfsi->acl_access); |
120 | nfsi->acl_access = ERR_PTR(-EAGAIN); | 120 | nfsi->acl_access = ERR_PTR(-EAGAIN); |
121 | } | 121 | } |
122 | if (nfsi->acl_default != ERR_PTR(-EAGAIN)) { | 122 | if (!IS_ERR(nfsi->acl_default)) { |
123 | posix_acl_release(nfsi->acl_default); | 123 | posix_acl_release(nfsi->acl_default); |
124 | nfsi->acl_default = ERR_PTR(-EAGAIN); | 124 | nfsi->acl_default = ERR_PTR(-EAGAIN); |
125 | } | 125 | } |
@@ -137,7 +137,7 @@ void nfs3_forget_cached_acls(struct inode *inode) | |||
137 | static struct posix_acl *nfs3_get_cached_acl(struct inode *inode, int type) | 137 | static struct posix_acl *nfs3_get_cached_acl(struct inode *inode, int type) |
138 | { | 138 | { |
139 | struct nfs_inode *nfsi = NFS_I(inode); | 139 | struct nfs_inode *nfsi = NFS_I(inode); |
140 | struct posix_acl *acl = ERR_PTR(-EAGAIN); | 140 | struct posix_acl *acl = ERR_PTR(-EINVAL); |
141 | 141 | ||
142 | spin_lock(&inode->i_lock); | 142 | spin_lock(&inode->i_lock); |
143 | switch(type) { | 143 | switch(type) { |
@@ -150,12 +150,13 @@ static struct posix_acl *nfs3_get_cached_acl(struct inode *inode, int type) | |||
150 | break; | 150 | break; |
151 | 151 | ||
152 | default: | 152 | default: |
153 | return ERR_PTR(-EINVAL); | 153 | goto out; |
154 | } | 154 | } |
155 | if (acl == ERR_PTR(-EAGAIN)) | 155 | if (IS_ERR(acl)) |
156 | acl = ERR_PTR(-EAGAIN); | 156 | acl = ERR_PTR(-EAGAIN); |
157 | else | 157 | else |
158 | acl = posix_acl_dup(acl); | 158 | acl = posix_acl_dup(acl); |
159 | out: | ||
159 | spin_unlock(&inode->i_lock); | 160 | spin_unlock(&inode->i_lock); |
160 | dprintk("NFS: nfs3_get_cached_acl(%s/%ld, %d) = %p\n", inode->i_sb->s_id, | 161 | dprintk("NFS: nfs3_get_cached_acl(%s/%ld, %d) = %p\n", inode->i_sb->s_id, |
161 | inode->i_ino, type, acl); | 162 | inode->i_ino, type, acl); |