diff mbox

nfsd: New counter for generating client confirm verifier

Message ID 55A990CB.6020201@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee July 17, 2015, 11:33 p.m. UTC
If using clientid_counter, gen_confirm will generate same verifier
in one second.

A new counter for client confirm verifier make sure gen_confirm
generating different each calling for the same clientid.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfsd/netns.h     | 1 +
 fs/nfsd/nfs4state.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Jeff Layton July 18, 2015, 12:16 p.m. UTC | #1
On Sat, 18 Jul 2015 07:33:31 +0800
Kinglong Mee <kinglongmee@gmail.com> wrote:

> If using clientid_counter, gen_confirm will generate same verifier
> in one second.
> 
> A new counter for client confirm verifier make sure gen_confirm
> generating different each calling for the same clientid.
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  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 61dfb33..5a64757e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1894,7 +1894,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));
>  }
>  

Reviewed-by: Jeff Layton <jlayton@poochiereds.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J. Bruce Fields July 20, 2015, 8:44 p.m. UTC | #2
On Sat, Jul 18, 2015 at 08:16:08AM -0400, Jeff Layton wrote:
> On Sat, 18 Jul 2015 07:33:31 +0800
> Kinglong Mee <kinglongmee@gmail.com> wrote:
> 
> > If using clientid_counter, gen_confirm will generate same verifier
> > in one second.
> > 
> > A new counter for client confirm verifier make sure gen_confirm
> > generating different each calling for the same clientid.
> > 
> > Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> > ---
> >  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 61dfb33..5a64757e 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -1894,7 +1894,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));
> >  }
> >  
> 
> Reviewed-by: Jeff Layton <jlayton@poochiereds.net>

Thanks.--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 61dfb33..5a64757e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1894,7 +1894,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));
 }