Commit 968d4ec0 authored by Scott Mayhew's avatar Scott Mayhew Committed by Greg Kroah-Hartman

nfs: add minor version to nfs_server_key for fscache

[ Upstream commit 55dee1bc ]

An NFS client that mounts multiple exports from the same NFS
server with higher NFSv4 versions disabled (i.e. 4.2) and without
forcing a specific NFS version results in fscache index cookie
collisions and the following messages:
[  570.004348] FS-Cache: Duplicate cookie detected

Each nfs_client structure should have its own fscache index cookie,
so add the minorversion to nfs_server_key.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=200145Signed-off-by: default avatarScott Mayhew <smayhew@redhat.com>
Signed-off-by: default avatarDave Wysochanski <dwysocha@redhat.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 967e9746
...@@ -157,6 +157,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) ...@@ -157,6 +157,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
goto error_0; goto error_0;
clp->cl_minorversion = cl_init->minorversion;
clp->cl_nfs_mod = cl_init->nfs_mod; clp->cl_nfs_mod = cl_init->nfs_mod;
if (!try_module_get(clp->cl_nfs_mod->owner)) if (!try_module_get(clp->cl_nfs_mod->owner))
goto error_dealloc; goto error_dealloc;
......
...@@ -35,6 +35,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock); ...@@ -35,6 +35,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock);
struct nfs_server_key { struct nfs_server_key {
struct { struct {
uint16_t nfsversion; /* NFS protocol version */ uint16_t nfsversion; /* NFS protocol version */
uint32_t minorversion; /* NFSv4 minor version */
uint16_t family; /* address family */ uint16_t family; /* address family */
__be16 port; /* IP port */ __be16 port; /* IP port */
} hdr; } hdr;
...@@ -59,6 +60,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp) ...@@ -59,6 +60,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
key.hdr.nfsversion = clp->rpc_ops->version; key.hdr.nfsversion = clp->rpc_ops->version;
key.hdr.minorversion = clp->cl_minorversion;
key.hdr.family = clp->cl_addr.ss_family; key.hdr.family = clp->cl_addr.ss_family;
switch (clp->cl_addr.ss_family) { switch (clp->cl_addr.ss_family) {
......
...@@ -210,7 +210,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) ...@@ -210,7 +210,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
INIT_LIST_HEAD(&clp->cl_ds_clients); INIT_LIST_HEAD(&clp->cl_ds_clients);
rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
clp->cl_minorversion = cl_init->minorversion;
clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
clp->cl_mig_gen = 1; clp->cl_mig_gen = 1;
#if IS_ENABLED(CONFIG_NFS_V4_1) #if IS_ENABLED(CONFIG_NFS_V4_1)
......
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