Linux NFS development
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: "J. Bruce Fields" <bfields@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 15/16] nfsd4: add new connections to session
Date: Thu, 30 Sep 2010 23:33:29 +0200	[thread overview]
Message-ID: <4CA50229.9000103@panasas.com> (raw)
In-Reply-To: <1285863553-8945-16-git-send-email-bfields@redhat.com>

On 2010-09-30 18:19, J. Bruce Fields wrote:
> As long as we're not implementing any session security, we should just
> automatically add any new connections that come along to the list of
> sessions associated with the session.

Doesn't the client need to send BIND_CONN_TO_SESSION?

18.34. Operation 41: BIND_CONN_TO_SESSION - Associate Connection with Session:

   BIND_CONN_TO_SESSION is used to associate additional connections with
   a session.  It MUST be used on the connection being associated with
   the session.

Also, with these patches, can we set SEQ4_STATUS_CB_PATH_DOWN if there's
no backchannel?

Benny

> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/nfs4state.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 47 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 3b4d74c..596702e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -658,13 +658,18 @@ static struct nfsd4_conn *alloc_conn(struct svc_rqst *rqstp)
>  	return conn;
>  }
>  
> +static void __nfsd4_hash_conn(struct nfsd4_conn *conn, struct nfsd4_session *ses)
> +{
> +	conn->cn_session = ses;
> +	list_add(&conn->cn_persession, &ses->se_conns);
> +}
> +
>  static void nfsd4_hash_conn(struct nfsd4_conn *conn, struct nfsd4_session *ses)
>  {
>  	struct nfs4_client *clp = ses->se_client;
>  
>  	spin_lock(&clp->cl_lock);
> -	conn->cn_session = ses;
> -	list_add(&conn->cn_persession, &ses->se_conns);
> +	__nfsd4_hash_conn(conn, ses);
>  	spin_unlock(&clp->cl_lock);
>  }
>  
> @@ -1612,6 +1617,44 @@ out:
>  	return status;
>  }
>  
> +static struct nfsd4_conn *__nfsd4_find_conn(struct svc_rqst *r, struct nfsd4_session *s)
> +{
> +	struct nfsd4_conn *c;
> +
> +	list_for_each_entry(c, &s->se_conns, cn_persession) {
> +		if (c->cn_xprt == r->rq_xprt) {
> +			return c;
> +		}
> +	}
> +	return NULL;
> +}
> +
> +static void nfsd4_sequence_check_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses)
> +{
> +	struct nfs4_client *clp = ses->se_client;
> +	struct nfsd4_conn *c, *new = NULL;
> +
> +	spin_lock(&clp->cl_lock);
> +	c = __nfsd4_find_conn(rqstp, ses);
> +	spin_unlock(&clp->cl_lock);
> +	if (c)
> +		return;
> +
> +	new = alloc_conn(rqstp);
> +
> +	spin_lock(&clp->cl_lock);
> +	c = __nfsd4_find_conn(rqstp, ses);
> +	if (c) {
> +		spin_unlock(&clp->cl_lock);
> +		free_conn(new);
> +		return;
> +	}
> +	__nfsd4_hash_conn(new, ses);
> +	spin_unlock(&clp->cl_lock);
> +	nfsd4_register_conn(new);
> +	return;
> +}
> +
>  __be32
>  nfsd4_sequence(struct svc_rqst *rqstp,
>  	       struct nfsd4_compound_state *cstate,
> @@ -1656,6 +1699,8 @@ nfsd4_sequence(struct svc_rqst *rqstp,
>  	if (status)
>  		goto out;
>  
> +	nfsd4_sequence_check_conn(rqstp, session);
> +
>  	/* Success! bump slot seqid */
>  	slot->sl_inuse = true;
>  	slot->sl_seqid = seq->seqid;

  reply	other threads:[~2010-09-30 21:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-30 16:18 4.1 patches J. Bruce Fields
2010-09-30 16:18 ` [PATCH 01/16] nfsd4: minor variable renaming (cb -> conn) J. Bruce Fields
2010-09-30 16:18 ` [PATCH 02/16] nfsd4: combine nfs4_rpc_args and nfsd4_cb_sequence J. Bruce Fields
2010-09-30 16:19 ` [PATCH 03/16] nfsd4: rename nfs4_rpc_args->nfsd4_cb_args J. Bruce Fields
2010-09-30 16:19 ` [PATCH 04/16] nfsd4: generic callback code J. Bruce Fields
2010-09-30 16:19 ` [PATCH 05/16] nfsd4: use generic callback code in null case J. Bruce Fields
2010-09-30 16:19 ` [PATCH 06/16] nfsd4: remove separate cb_args struct J. Bruce Fields
2010-09-30 16:19 ` [PATCH 07/16] nfsd4: Move callback setup to callback queue J. Bruce Fields
2010-09-30 16:19 ` [PATCH 08/16] nfsd4: fix alloc_init_session BUILD_BUG_ON() J. Bruce Fields
2010-09-30 16:19 ` [PATCH 09/16] nfsd4: fix alloc_init_session return type J. Bruce Fields
2010-09-30 16:19 ` [PATCH 10/16] nfsd4: clean up session allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 11/16] nfsd4: keep per-session list of connections J. Bruce Fields
2010-09-30 21:21   ` Benny Halevy
2010-09-30 21:38     ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 12/16] nfsd: provide callbacks on svc_xprt deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 13/16] nfsd4: use callbacks on svc_xprt_deletion J. Bruce Fields
2010-09-30 16:19 ` [PATCH 14/16] nfsd4: refactor connection allocation J. Bruce Fields
2010-09-30 16:19 ` [PATCH 15/16] nfsd4: add new connections to session J. Bruce Fields
2010-09-30 21:33   ` Benny Halevy [this message]
2010-09-30 21:57     ` J. Bruce Fields
2010-09-30 16:19 ` [PATCH 16/16] nfsd4: enforce DESTROY_SESSION connection requirement 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=4CA50229.9000103@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=bfields@redhat.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