summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-03 13:39:24 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-04 22:35:41 -0400
commitdea1bb35c5f35e0577cfc61f79261d80b8715221 (patch)
treef0485667a30a19ca07fd745ef3c88aa360edcea2
parent09a54f0ebfe263bc27c90bbd80187b9a93283887 (diff)
NFS: Fix regression whereby fscache errors are appearing on 'nofsc' mounts
People are reporing seeing fscache errors being reported concerning duplicate cookies even in cases where they are not setting up fscache at all. The rule needs to be that if fscache is not enabled, then it should have no side effects at all. To ensure this is the case, we disable fscache completely on all superblocks for which the 'fsc' mount option was not set. In order to avoid issues with '-oremount', we also disable the ability to turn fscache on via remount. Fixes: f1fe29b4a02d ("NFS: Use i_writecount to control whether...") Link: https://bugzilla.kernel.org/show_bug.cgi?id=200145 Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: Steve Dickson <steved@redhat.com> Cc: David Howells <dhowells@redhat.com>
-rw-r--r--fs/nfs/fscache.c7
-rw-r--r--fs/nfs/fscache.h2
-rw-r--r--fs/nfs/super.c1
3 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 53507aa96b0b..3800ab6f08fa 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -114,6 +114,10 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int
114 struct rb_node **p, *parent; 114 struct rb_node **p, *parent;
115 int diff; 115 int diff;
116 116
117 nfss->fscache_key = NULL;
118 nfss->fscache = NULL;
119 if (!(nfss->options & NFS_OPTION_FSCACHE))
120 return;
117 if (!uniq) { 121 if (!uniq) {
118 uniq = ""; 122 uniq = "";
119 ulen = 1; 123 ulen = 1;
@@ -226,10 +230,11 @@ void nfs_fscache_release_super_cookie(struct super_block *sb)
226void nfs_fscache_init_inode(struct inode *inode) 230void nfs_fscache_init_inode(struct inode *inode)
227{ 231{
228 struct nfs_fscache_inode_auxdata auxdata; 232 struct nfs_fscache_inode_auxdata auxdata;
233 struct nfs_server *nfss = NFS_SERVER(inode);
229 struct nfs_inode *nfsi = NFS_I(inode); 234 struct nfs_inode *nfsi = NFS_I(inode);
230 235
231 nfsi->fscache = NULL; 236 nfsi->fscache = NULL;
232 if (!S_ISREG(inode->i_mode)) 237 if (!(nfss->fscache && S_ISREG(inode->i_mode)))
233 return; 238 return;
234 239
235 memset(&auxdata, 0, sizeof(auxdata)); 240 memset(&auxdata, 0, sizeof(auxdata));
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 25a75e40d91d..ad041cfbf9ec 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -182,7 +182,7 @@ static inline void nfs_fscache_wait_on_invalidate(struct inode *inode)
182 */ 182 */
183static inline const char *nfs_server_fscache_state(struct nfs_server *server) 183static inline const char *nfs_server_fscache_state(struct nfs_server *server)
184{ 184{
185 if (server->fscache && (server->options & NFS_OPTION_FSCACHE)) 185 if (server->fscache)
186 return "yes"; 186 return "yes";
187 return "no "; 187 return "no ";
188} 188}
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 628631e2e34f..703f595dce90 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2260,6 +2260,7 @@ nfs_compare_remount_data(struct nfs_server *nfss,
2260 data->acdirmin != nfss->acdirmin / HZ || 2260 data->acdirmin != nfss->acdirmin / HZ ||
2261 data->acdirmax != nfss->acdirmax / HZ || 2261 data->acdirmax != nfss->acdirmax / HZ ||
2262 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || 2262 data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
2263 (data->options & NFS_OPTION_FSCACHE) != (nfss->options & NFS_OPTION_FSCACHE) ||
2263 data->nfs_server.port != nfss->port || 2264 data->nfs_server.port != nfss->port ||
2264 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || 2265 data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
2265 !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, 2266 !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address,