linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
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: Sat, 4 Feb 2012 07:21:45 -0500	[thread overview]
Message-ID: <20120204072145.754b6b3e@tlielax.poochiereds.net> (raw)
In-Reply-To: <20120203193533.GA2999@fieldses.org>

On Fri, 3 Feb 2012 14:35:33 -0500
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> 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.
> 

Ahh ok, I missed that that was what that was for. Looks like I probably
have a couple of bugs here with that too. There are some places that
check cl_firststate and since the new code doesn't set it it would be
wrong.

I'll respin this patch to merge that in with this change. Thanks.

> > 
> > 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
> > 
> --
> 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


-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2012-02-04 12:21 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
2012-02-04 12:21     ` Jeff Layton [this message]
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=20120204072145.754b6b3e@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=bfields@fieldses.org \
    --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).