All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v5 3/5] nfsd: convert nfs4_client->cl_cb_flags to a generic flags field
Date: Fri, 3 Feb 2012 14:35:33 -0500	[thread overview]
Message-ID: <20120203193533.GA2999@fieldses.org> (raw)
In-Reply-To: <1328111052-28389-4-git-send-email-jlayton@redhat.com>

On Wed, Feb 01, 2012 at 10:44:10AM -0500, Jeff Layton wrote:
> We'll need a way to flag the nfs4_client as already being recorded on
> stable storage so that we don't continually upcall.

Looks like the code currently uses cl_firststate for that purpose.

I'm perfectly open to the argument that using a u32 to store a boolean
is rather silly, and can't see any problem with doing it this way
instead, but then let's remove cl_firstate while we're at it.

--b.

> 
> The cl_cb_flags field is only using 2 bits right now, so repurpose that
> to a generic flags field. Rename NFSD4_CLIENT_KILL to
> NFSD4_CLIENT_CB_KILL to make it evident that it's part of the callback
> flags. Add a mask that we can use for existing checks that look to see
> whether any flags are set, so that the new STABLE flag doesn't
> interfere.
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/nfsd/nfs4callback.c |   12 ++++++------
>  fs/nfsd/state.h        |    8 +++++---
>  2 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
> index 6f3ebb4..730e2cc 100644
> --- a/fs/nfsd/nfs4callback.c
> +++ b/fs/nfsd/nfs4callback.c
> @@ -756,7 +756,7 @@ void nfsd4_probe_callback(struct nfs4_client *clp)
>  {
>  	/* XXX: atomicity?  Also, should we be using cl_cb_flags? */
>  	clp->cl_cb_state = NFSD4_CB_UNKNOWN;
> -	set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_cb_flags);
> +	set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
>  	do_probe_callback(clp);
>  }
>  
> @@ -915,7 +915,7 @@ void nfsd4_destroy_callback_queue(void)
>  /* must be called under the state lock */
>  void nfsd4_shutdown_callback(struct nfs4_client *clp)
>  {
> -	set_bit(NFSD4_CLIENT_KILL, &clp->cl_cb_flags);
> +	set_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags);
>  	/*
>  	 * Note this won't actually result in a null callback;
>  	 * instead, nfsd4_do_callback_rpc() will detect the killed
> @@ -966,15 +966,15 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
>  		svc_xprt_put(clp->cl_cb_conn.cb_xprt);
>  		clp->cl_cb_conn.cb_xprt = NULL;
>  	}
> -	if (test_bit(NFSD4_CLIENT_KILL, &clp->cl_cb_flags))
> +	if (test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags))
>  		return;
>  	spin_lock(&clp->cl_lock);
>  	/*
>  	 * Only serialized callback code is allowed to clear these
>  	 * flags; main nfsd code can only set them:
>  	 */
> -	BUG_ON(!clp->cl_cb_flags);
> -	clear_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_cb_flags);
> +	BUG_ON(!(clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK));
> +	clear_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
>  	memcpy(&conn, &cb->cb_clp->cl_cb_conn, sizeof(struct nfs4_cb_conn));
>  	c = __nfsd4_find_backchannel(clp);
>  	if (c) {
> @@ -1000,7 +1000,7 @@ void nfsd4_do_callback_rpc(struct work_struct *w)
>  	struct nfs4_client *clp = cb->cb_clp;
>  	struct rpc_clnt *clnt;
>  
> -	if (clp->cl_cb_flags)
> +	if (clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK)
>  		nfsd4_process_cb_update(cb);
>  
>  	clnt = clp->cl_cb_client;
> diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
> index 8f539ee..0f9a0ac 100644
> --- a/fs/nfsd/state.h
> +++ b/fs/nfsd/state.h
> @@ -250,9 +250,11 @@ struct nfs4_client {
>  
>  	/* for v4.0 and v4.1 callbacks: */
>  	struct nfs4_cb_conn	cl_cb_conn;
> -#define NFSD4_CLIENT_CB_UPDATE	1
> -#define NFSD4_CLIENT_KILL	2
> -	unsigned long		cl_cb_flags;
> +#define NFSD4_CLIENT_STABLE		(0)	/* client on stable storage */
> +#define NFSD4_CLIENT_CB_UPDATE		(1)
> +#define NFSD4_CLIENT_CB_KILL		(2)
> +#define NFSD4_CLIENT_CB_FLAG_MASK	(0x6)
> +	unsigned long		cl_flags;
>  	struct rpc_clnt		*cl_cb_client;
>  	u32			cl_cb_ident;
>  #define NFSD4_CB_UP		0
> -- 
> 1.7.7.6
> 

  reply	other threads:[~2012-02-03 19:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 15:44 [PATCH v5 0/5] nfsd: overhaul the client name tracking code Jeff Layton
2012-02-01 15:44 ` [PATCH v5 1/5] nfsd: add nfsd4_client_tracking_ops struct and a way to set it Jeff Layton
2012-02-02 22:45   ` J. Bruce Fields
2012-02-03 19:22     ` Jeff Layton
2012-02-01 15:44 ` [PATCH v5 2/5] sunrpc: create nfsd dir in rpc_pipefs Jeff Layton
2012-02-01 15:44 ` [PATCH v5 3/5] nfsd: convert nfs4_client->cl_cb_flags to a generic flags field Jeff Layton
2012-02-03 19:35   ` J. Bruce Fields [this message]
2012-02-04 12:21     ` Jeff Layton
2012-02-08 21:00     ` Jeff Layton
2012-02-10 16:06       ` Jeff Layton
2012-02-01 15:44 ` [PATCH v5 4/5] nfsd: add a header describing upcall to nfsdcld Jeff Layton
2012-02-01 15:44 ` [PATCH v5 5/5] nfsd: add the infrastructure to handle the cld upcall Jeff Layton
2012-02-03 22:57   ` J. Bruce Fields
2012-02-04 11:49     ` Jeff Layton
2012-02-07 15:00       ` Jeff Layton
2012-02-07 15:19         ` 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=20120203193533.GA2999@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.