aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/inode.c14
-rw-r--r--fs/nfs/internal.h9
2 files changed, 19 insertions, 4 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 28a0a3cbd3b7..360114ae8b82 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -164,17 +164,16 @@ static void nfs_zap_caches_locked(struct inode *inode)
164 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { 164 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
165 nfs_fscache_invalidate(inode); 165 nfs_fscache_invalidate(inode);
166 nfsi->cache_validity |= NFS_INO_INVALID_ATTR 166 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
167 | NFS_INO_INVALID_LABEL
168 | NFS_INO_INVALID_DATA 167 | NFS_INO_INVALID_DATA
169 | NFS_INO_INVALID_ACCESS 168 | NFS_INO_INVALID_ACCESS
170 | NFS_INO_INVALID_ACL 169 | NFS_INO_INVALID_ACL
171 | NFS_INO_REVAL_PAGECACHE; 170 | NFS_INO_REVAL_PAGECACHE;
172 } else 171 } else
173 nfsi->cache_validity |= NFS_INO_INVALID_ATTR 172 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
174 | NFS_INO_INVALID_LABEL
175 | NFS_INO_INVALID_ACCESS 173 | NFS_INO_INVALID_ACCESS
176 | NFS_INO_INVALID_ACL 174 | NFS_INO_INVALID_ACL
177 | NFS_INO_REVAL_PAGECACHE; 175 | NFS_INO_REVAL_PAGECACHE;
176 nfs_zap_label_cache_locked(nfsi);
178} 177}
179 178
180void nfs_zap_caches(struct inode *inode) 179void nfs_zap_caches(struct inode *inode)
@@ -266,6 +265,13 @@ nfs_init_locked(struct inode *inode, void *opaque)
266} 265}
267 266
268#ifdef CONFIG_NFS_V4_SECURITY_LABEL 267#ifdef CONFIG_NFS_V4_SECURITY_LABEL
268static void nfs_clear_label_invalid(struct inode *inode)
269{
270 spin_lock(&inode->i_lock);
271 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_LABEL;
272 spin_unlock(&inode->i_lock);
273}
274
269void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, 275void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
270 struct nfs4_label *label) 276 struct nfs4_label *label)
271{ 277{
@@ -283,6 +289,7 @@ void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
283 __func__, 289 __func__,
284 (char *)label->label, 290 (char *)label->label,
285 label->len, error); 291 label->len, error);
292 nfs_clear_label_invalid(inode);
286 } 293 }
287} 294}
288 295
@@ -1648,7 +1655,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1648 inode->i_blocks = fattr->du.nfs2.blocks; 1655 inode->i_blocks = fattr->du.nfs2.blocks;
1649 1656
1650 /* Update attrtimeo value if we're out of the unstable period */ 1657 /* Update attrtimeo value if we're out of the unstable period */
1651 if (invalid & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_LABEL)) { 1658 if (invalid & NFS_INO_INVALID_ATTR) {
1652 nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE); 1659 nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
1653 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); 1660 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
1654 nfsi->attrtimeo_timestamp = now; 1661 nfsi->attrtimeo_timestamp = now;
@@ -1661,7 +1668,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1661 } 1668 }
1662 } 1669 }
1663 invalid &= ~NFS_INO_INVALID_ATTR; 1670 invalid &= ~NFS_INO_INVALID_ATTR;
1664 invalid &= ~NFS_INO_INVALID_LABEL;
1665 /* Don't invalidate the data if we were to blame */ 1671 /* Don't invalidate the data if we were to blame */
1666 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) 1672 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
1667 || S_ISLNK(inode->i_mode))) 1673 || S_ISLNK(inode->i_mode)))
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 8b5cc04a8611..fafdddac8271 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -279,9 +279,18 @@ static inline void nfs4_label_free(struct nfs4_label *label)
279 } 279 }
280 return; 280 return;
281} 281}
282
283static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi)
284{
285 if (nfs_server_capable(&nfsi->vfs_inode, NFS_CAP_SECURITY_LABEL))
286 nfsi->cache_validity |= NFS_INO_INVALID_LABEL;
287}
282#else 288#else
283static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } 289static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
284static inline void nfs4_label_free(void *label) {} 290static inline void nfs4_label_free(void *label) {}
291static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi)
292{
293}
285#endif /* CONFIG_NFS_V4_SECURITY_LABEL */ 294#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
286 295
287/* proc.c */ 296/* proc.c */