linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/2] NFSD: SETCLIENTID_CONFIRM returns NFS4ERR_CLID_INUSE too often
Date: Tue, 15 May 2012 21:32:39 -0400	[thread overview]
Message-ID: <20120516013239.GA24133@pad.fieldses.org> (raw)
In-Reply-To: <20120515214207.1518.78590.stgit@lebasque.1015granger.net>

On Tue, May 15, 2012 at 05:42:08PM -0400, Chuck Lever wrote:
> According to RFC 3530bis, the only items SETCLIENTID_CONFIRM
> processing should be concerned with is the clientid, clientid
> verifier, and authentication flavor.

Nit: the spec says "principal", not "authentication flavor".

(I was looking at this yesterday because our current code only compares
uid's, which is pretty meaningless--any client using a krb5 service
principal, for example, will likely get mapped to the same uid--so I
have patches that instead compare flavor, principal name (when we have
it--our current userspace only passes it down for service principals)
and groups and auxiliary groups as well as uid.  But not IP address...)

Anyway, this patch looks reasonable, thanks.

--b.

> The client's IP address
> is not supposed to be interesting.
> 
> And, NFS4ERR_CLID_INUSE is meant only for authentication flavor
> mismatches.
> 
> I triggered this logic with a prototype UCS client -- one that
> uses the same nfs_client_id4 string for all servers.  The client
> mounted our server via its IPv4, then via its IPv6 address.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 
>  fs/nfsd/nfs4state.c |   14 ++------------
>  1 files changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 7f71c69..27e6401 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -2213,7 +2213,6 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
>  			 struct nfsd4_compound_state *cstate,
>  			 struct nfsd4_setclientid_confirm *setclientid_confirm)
>  {
> -	struct sockaddr *sa = svc_addr(rqstp);
>  	struct nfs4_client *conf, *unconf;
>  	nfs4_verifier confirm = setclientid_confirm->sc_confirm; 
>  	clientid_t * clid = &setclientid_confirm->sc_clientid;
> @@ -2231,17 +2230,12 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
>  	conf = find_confirmed_client(clid);
>  	unconf = find_unconfirmed_client(clid);
>  
> -	status = nfserr_clid_inuse;
> -	if (conf && !rpc_cmp_addr((struct sockaddr *) &conf->cl_addr, sa))
> -		goto out;
> -	if (unconf && !rpc_cmp_addr((struct sockaddr *) &unconf->cl_addr, sa))
> -		goto out;
> -
>  	/*
>  	 * section 14.2.34 of RFC 3530 has a description of
>  	 * SETCLIENTID_CONFIRM request processing consisting
>  	 * of 4 bullet points, labeled as CASE1 - CASE4 below.
>  	 */
> +	status = nfserr_clid_inuse;
>  	if (conf && unconf && same_verf(&confirm, &unconf->cl_confirm)) {
>  		/*
>  		 * RFC 3530 14.2.34 CASE 1:
> @@ -2254,7 +2248,6 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
>  			nfsd4_probe_callback(conf);
>  			expire_client(unconf);
>  			status = nfs_ok;
> -
>  		}
>  	} else if (conf && !unconf) {
>  		/*
> @@ -2296,11 +2289,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
>  		 * Client probably hasn't noticed that we rebooted yet.
>  		 */
>  		status = nfserr_stale_clientid;
> -	} else {
> -		/* check that we have hit one of the cases...*/
> -		status = nfserr_clid_inuse;
>  	}
> -out:
> +
>  	nfs4_unlock_state();
>  	return status;
>  }
> 

  reply	other threads:[~2012-05-16  1:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 21:41 [PATCH 0/2] NFSD patches for 3.5 Chuck Lever
2012-05-15 21:42 ` [PATCH 1/2] NFSD: SETCLIENTID_CONFIRM returns NFS4ERR_CLID_INUSE too often Chuck Lever
2012-05-16  1:32   ` J. Bruce Fields [this message]
2012-05-16  2:34     ` Chuck Lever
2012-05-16 12:52       ` J. Bruce Fields
2012-05-15 21:42 ` [PATCH 2/2] NFSD: Use __be32 for variable holding return value Chuck Lever
2012-05-16 12:52   ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120516013239.GA24133@pad.fieldses.org \
    --to=bfields@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).