nfsd: New counter for generating client confirm verifier
authorKinglong Mee <kinglongmee@gmail.com>
Fri, 17 Jul 2015 23:33:31 +0000 (07:33 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 10 Aug 2015 20:05:47 +0000 (16:05 -0400)
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 <kinglongmee@gmail.com>
Reviewed-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/netns.h
fs/nfsd/nfs4state.c

index ea6749a327602de97a5bbbea81058acad1522bbd..d8b16c2568f30f906dc49eb77597fabbd718ee4b 100644 (file)
@@ -110,6 +110,7 @@ struct nfsd_net {
        unsigned int max_connections;
 
        u32 clientid_counter;
+       u32 clverifier_counter;
 
        struct svc_serv *nfsd_serv;
 };
index 5018b6ecfe7466b1041a7bfe2c0f049e74538ad7..cd8c33186e26eb5fbead2ad015d7fbbd5777f624 100644 (file)
@@ -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->cl_confirm.data, verf, sizeof(clp->cl_confirm.data));
 }