nfsd: New counter for generating client confirm verifier

This change “nfsd: New counter for generating client confirm verifier” in Linux kernel is authored by Kinglong Mee <kinglongmee [at]> on Sat Jul 18 07:33:31 2015 +0800.

nfsd: New counter for generating client confirm verifier

If using clientid_counter, it seems possible that gen_confirm could
generate the same verifier for the same client in some situations.

Add a new counter for client confirm verifier to make sure gen_confirm
generates a different verifier on each call for the same clientid.

Signed-off-by: Kinglong Mee <>
Reviewed-by: Jeff Layton <>
Signed-off-by: J. Bruce Fields <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 19311aa.

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/nfsd/netns.h     | 1 +
 fs/nfsd/nfs4state.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index ea6749a..d8b16c2 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -110,6 +110,7 @@ struct nfsd_net {
 	unsigned int max_connections;
 	u32 clientid_counter;
+	u32 clverifier_counter;
 	struct svc_serv *nfsd_serv;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5018b6e..cd8c331 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1899,7 +1899,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn)
 	 * __force to keep sparse happy
 	verf[0] = (__force __be32)get_seconds();
-	verf[1] = (__force __be32)nn->clientid_counter;
+	verf[1] = (__force __be32)nn->clverifier_counter++;
 	memcpy(clp->, verf, sizeof(clp->;

The commit for this change in Linux stable tree is 19311aa (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *