aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/internal.h
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-02-06 14:38:53 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-02-10 08:44:12 -0500
commitfd1defc257e2b12ab69bc0b379105c00eca4e112 (patch)
treef0058b38b262aacd30da1ac5e4e85fb37451f559 /fs/nfs/internal.h
parentb28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff)
NFS: Do not set NFS_INO_INVALID_LABEL unless server supports labeled NFS
Commit aa9c2669626c (NFS: Client implementation of Labeled-NFS) introduces a performance regression. When nfs_zap_caches_locked is called, it sets the NFS_INO_INVALID_LABEL flag irrespectively of whether or not the NFS server supports security labels. Since that flag is never cleared, it means that all calls to nfs_revalidate_inode() will now trigger an on-the-wire GETATTR call. This patch ensures that we never set the NFS_INO_INVALID_LABEL unless the server advertises support for labeled NFS. It also causes nfs_setsecurity() to clear NFS_INO_INVALID_LABEL when it has successfully set the security label for the inode. Finally it gets rid of the NFS_INO_INVALID_LABEL cruft from nfs_update_inode, which has nothing to do with labeled NFS. Reported-by: Neil Brown <neilb@suse.de> Cc: stable@vger.kernel.org # 3.11+ Tested-by: Neil Brown <neilb@suse.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/internal.h')
-rw-r--r--fs/nfs/internal.h9
1 files changed, 9 insertions, 0 deletions
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 */