Commit b6fb2f5b authored by Trond Myklebust's avatar Trond Myklebust Committed by Greg Kroah-Hartman

NFS: Fix regression whereby fscache errors are appearing on 'nofsc' mounts

[ Upstream commit dea1bb35 ]

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: f1fe29b4 ("NFS: Use i_writecount to control whether...")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=200145Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Cc: Steve Dickson <steved@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 66daeec3
...@@ -118,6 +118,10 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int ...@@ -118,6 +118,10 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int
struct rb_node **p, *parent; struct rb_node **p, *parent;
int diff; int diff;
nfss->fscache_key = NULL;
nfss->fscache = NULL;
if (!(nfss->options & NFS_OPTION_FSCACHE))
return;
if (!uniq) { if (!uniq) {
uniq = ""; uniq = "";
ulen = 1; ulen = 1;
...@@ -230,10 +234,11 @@ void nfs_fscache_release_super_cookie(struct super_block *sb) ...@@ -230,10 +234,11 @@ void nfs_fscache_release_super_cookie(struct super_block *sb)
void nfs_fscache_init_inode(struct inode *inode) void nfs_fscache_init_inode(struct inode *inode)
{ {
struct nfs_fscache_inode_auxdata auxdata; struct nfs_fscache_inode_auxdata auxdata;
struct nfs_server *nfss = NFS_SERVER(inode);
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
nfsi->fscache = NULL; nfsi->fscache = NULL;
if (!S_ISREG(inode->i_mode)) if (!(nfss->fscache && S_ISREG(inode->i_mode)))
return; return;
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
......
...@@ -186,7 +186,7 @@ static inline void nfs_fscache_wait_on_invalidate(struct inode *inode) ...@@ -186,7 +186,7 @@ static inline void nfs_fscache_wait_on_invalidate(struct inode *inode)
*/ */
static inline const char *nfs_server_fscache_state(struct nfs_server *server) static inline const char *nfs_server_fscache_state(struct nfs_server *server)
{ {
if (server->fscache && (server->options & NFS_OPTION_FSCACHE)) if (server->fscache)
return "yes"; return "yes";
return "no "; return "no ";
} }
......
...@@ -2239,6 +2239,7 @@ nfs_compare_remount_data(struct nfs_server *nfss, ...@@ -2239,6 +2239,7 @@ nfs_compare_remount_data(struct nfs_server *nfss,
data->acdirmin != nfss->acdirmin / HZ || data->acdirmin != nfss->acdirmin / HZ ||
data->acdirmax != nfss->acdirmax / HZ || data->acdirmax != nfss->acdirmax / HZ ||
data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
(data->options & NFS_OPTION_FSCACHE) != (nfss->options & NFS_OPTION_FSCACHE) ||
data->nfs_server.port != nfss->port || data->nfs_server.port != nfss->port ||
data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
!rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment