Commit 4814f56d19137b3b9fa8e00e1d332b3683b950de
Committed by
Trond Myklebust
1 parent
1842bfb447
Exists in
master
and in
7 other branches
NFSv3: Client-side nfsacl caching fix
Fix two errors in the client-side acl cache: First, when nfs3_proc_getacl requests only the default acl of a file and the access acl is not cached already, a NULL access acl entry is cached instead of ERR_PTR(-EAGAIN) ("not cached"). Second, update the cached acls in nfs3_proc_setacls: nfs_refresh_inode does not always invalidate the cached acls, and when it does not, the cached acls get out of sync. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Showing 1 changed file with 8 additions and 3 deletions Side-by-side Diff
fs/nfs/nfs3acl.c
... | ... | @@ -172,8 +172,10 @@ |
172 | 172 | inode->i_ino, acl, dfacl); |
173 | 173 | spin_lock(&inode->i_lock); |
174 | 174 | __nfs3_forget_cached_acls(NFS_I(inode)); |
175 | - nfsi->acl_access = posix_acl_dup(acl); | |
176 | - nfsi->acl_default = posix_acl_dup(dfacl); | |
175 | + if (!IS_ERR(acl)) | |
176 | + nfsi->acl_access = posix_acl_dup(acl); | |
177 | + if (!IS_ERR(dfacl)) | |
178 | + nfsi->acl_default = posix_acl_dup(dfacl); | |
177 | 179 | spin_unlock(&inode->i_lock); |
178 | 180 | } |
179 | 181 | |
... | ... | @@ -254,7 +256,9 @@ |
254 | 256 | res.acl_access = NULL; |
255 | 257 | } |
256 | 258 | } |
257 | - nfs3_cache_acls(inode, res.acl_access, res.acl_default); | |
259 | + nfs3_cache_acls(inode, | |
260 | + (res.mask & NFS_ACL) ? res.acl_access : ERR_PTR(-EINVAL), | |
261 | + (res.mask & NFS_DFACL) ? res.acl_default : ERR_PTR(-EINVAL)); | |
258 | 262 | |
259 | 263 | switch(type) { |
260 | 264 | case ACL_TYPE_ACCESS: |
... | ... | @@ -329,6 +333,7 @@ |
329 | 333 | switch (status) { |
330 | 334 | case 0: |
331 | 335 | status = nfs_refresh_inode(inode, &fattr); |
336 | + nfs3_cache_acls(inode, acl, dfacl); | |
332 | 337 | break; |
333 | 338 | case -EPFNOSUPPORT: |
334 | 339 | case -EPROTONOSUPPORT: |