Skip to content

Commit 55dee1b

Browse files
scottmayhewamschuma-ntap
authored andcommitted
nfs: add minor version to nfs_server_key for fscache
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=200145 Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Dave Wysochanski <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 75a9b91 commit 55dee1b

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

fs/nfs/client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init)
153153
if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
154154
goto error_0;
155155

156+
clp->cl_minorversion = cl_init->minorversion;
156157
clp->cl_nfs_mod = cl_init->nfs_mod;
157158
if (!try_module_get(clp->cl_nfs_mod->owner))
158159
goto error_dealloc;

fs/nfs/fscache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock);
3131
struct nfs_server_key {
3232
struct {
3333
uint16_t nfsversion; /* NFS protocol version */
34+
uint32_t minorversion; /* NFSv4 minor version */
3435
uint16_t family; /* address family */
3536
__be16 port; /* IP port */
3637
} hdr;
@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp)
5556

5657
memset(&key, 0, sizeof(key));
5758
key.hdr.nfsversion = clp->rpc_ops->version;
59+
key.hdr.minorversion = clp->cl_minorversion;
5860
key.hdr.family = clp->cl_addr.ss_family;
5961

6062
switch (clp->cl_addr.ss_family) {

fs/nfs/nfs4client.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
216216
INIT_LIST_HEAD(&clp->cl_ds_clients);
217217
rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
218218
clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
219-
clp->cl_minorversion = cl_init->minorversion;
220219
clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
221220
clp->cl_mig_gen = 1;
222221
#if IS_ENABLED(CONFIG_NFS_V4_1)

0 commit comments

Comments
 (0)