diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-06-11 17:39:04 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-07-09 12:09:19 -0400 |
commit | f41f741838480aeaa3a189cff6e210503cf9c42d (patch) | |
tree | fc4509d47132c28ca211e57d8f59b56accb6db8b /fs/nfs | |
parent | 2e96d2867245668dbdb973729288cf69b9fafa66 (diff) |
NFS: Ensure we zap only the access and acl caches when setting new acls
...and ensure that we obey the NFS_INO_INVALID_ACL flag when retrieving the
acls.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs3acl.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 5 |
4 files changed, 12 insertions, 7 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2e4ab4a5e107..2c23d067e2a6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -57,8 +57,6 @@ static int enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED; | |||
57 | static void nfs_invalidate_inode(struct inode *); | 57 | static void nfs_invalidate_inode(struct inode *); |
58 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); | 58 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); |
59 | 59 | ||
60 | static void nfs_zap_acl_cache(struct inode *); | ||
61 | |||
62 | static struct kmem_cache * nfs_inode_cachep; | 60 | static struct kmem_cache * nfs_inode_cachep; |
63 | 61 | ||
64 | static inline unsigned long | 62 | static inline unsigned long |
@@ -167,7 +165,7 @@ void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) | |||
167 | } | 165 | } |
168 | } | 166 | } |
169 | 167 | ||
170 | static void nfs_zap_acl_cache(struct inode *inode) | 168 | void nfs_zap_acl_cache(struct inode *inode) |
171 | { | 169 | { |
172 | void (*clear_acl_cache)(struct inode *); | 170 | void (*clear_acl_cache)(struct inode *); |
173 | 171 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 04ae867dddba..24241fcbb98d 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -150,6 +150,7 @@ extern void nfs_clear_inode(struct inode *); | |||
150 | #ifdef CONFIG_NFS_V4 | 150 | #ifdef CONFIG_NFS_V4 |
151 | extern void nfs4_clear_inode(struct inode *); | 151 | extern void nfs4_clear_inode(struct inode *); |
152 | #endif | 152 | #endif |
153 | void nfs_zap_acl_cache(struct inode *inode); | ||
153 | 154 | ||
154 | /* super.c */ | 155 | /* super.c */ |
155 | extern struct file_system_type nfs_xdev_fs_type; | 156 | extern struct file_system_type nfs_xdev_fs_type; |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 9b7362565c0c..423842f51ac9 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <linux/posix_acl_xattr.h> | 5 | #include <linux/posix_acl_xattr.h> |
6 | #include <linux/nfsacl.h> | 6 | #include <linux/nfsacl.h> |
7 | 7 | ||
8 | #include "internal.h" | ||
9 | |||
8 | #define NFSDBG_FACILITY NFSDBG_PROC | 10 | #define NFSDBG_FACILITY NFSDBG_PROC |
9 | 11 | ||
10 | ssize_t nfs3_listxattr(struct dentry *dentry, char *buffer, size_t size) | 12 | ssize_t nfs3_listxattr(struct dentry *dentry, char *buffer, size_t size) |
@@ -205,6 +207,8 @@ struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type) | |||
205 | status = nfs_revalidate_inode(server, inode); | 207 | status = nfs_revalidate_inode(server, inode); |
206 | if (status < 0) | 208 | if (status < 0) |
207 | return ERR_PTR(status); | 209 | return ERR_PTR(status); |
210 | if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL) | ||
211 | nfs_zap_acl_cache(inode); | ||
208 | acl = nfs3_get_cached_acl(inode, type); | 212 | acl = nfs3_get_cached_acl(inode, type); |
209 | if (acl != ERR_PTR(-EAGAIN)) | 213 | if (acl != ERR_PTR(-EAGAIN)) |
210 | return acl; | 214 | return acl; |
@@ -319,9 +323,8 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, | |||
319 | dprintk("NFS call setacl\n"); | 323 | dprintk("NFS call setacl\n"); |
320 | msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL]; | 324 | msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL]; |
321 | status = rpc_call_sync(server->client_acl, &msg, 0); | 325 | status = rpc_call_sync(server->client_acl, &msg, 0); |
322 | spin_lock(&inode->i_lock); | 326 | nfs_access_zap_cache(inode); |
323 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS; | 327 | nfs_zap_acl_cache(inode); |
324 | spin_unlock(&inode->i_lock); | ||
325 | dprintk("NFS reply setacl: %d\n", status); | 328 | dprintk("NFS reply setacl: %d\n", status); |
326 | 329 | ||
327 | /* pages may have been allocated at the xdr layer. */ | 330 | /* pages may have been allocated at the xdr layer. */ |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 058723d9122d..10f01c05a4e4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2695,6 +2695,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen) | |||
2695 | ret = nfs_revalidate_inode(server, inode); | 2695 | ret = nfs_revalidate_inode(server, inode); |
2696 | if (ret < 0) | 2696 | if (ret < 0) |
2697 | return ret; | 2697 | return ret; |
2698 | if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL) | ||
2699 | nfs_zap_acl_cache(inode); | ||
2698 | ret = nfs4_read_cached_acl(inode, buf, buflen); | 2700 | ret = nfs4_read_cached_acl(inode, buf, buflen); |
2699 | if (ret != -ENOENT) | 2701 | if (ret != -ENOENT) |
2700 | return ret; | 2702 | return ret; |
@@ -2722,7 +2724,8 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl | |||
2722 | nfs_inode_return_delegation(inode); | 2724 | nfs_inode_return_delegation(inode); |
2723 | buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); | 2725 | buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); |
2724 | ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); | 2726 | ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); |
2725 | nfs_zap_caches(inode); | 2727 | nfs_access_zap_cache(inode); |
2728 | nfs_zap_acl_cache(inode); | ||
2726 | return ret; | 2729 | return ret; |
2727 | } | 2730 | } |
2728 | 2731 | ||