nfsd: convert nfs4_client->cl_cb_flags to a generic flags field
We'll need a way to flag the nfs4_client as already being recorded on stable storage so that we don't continually upcall. Currently, that's recorded in the cl_firststate field of the client struct. Using an entire u32 to store a flag is rather wasteful though. 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 flags don't interfere. Convert all references to cl_firstate to the NFSD4_CLIENT_STABLE flag, and add a new NFSD4_CLIENT_RECLAIM_COMPLETE flag. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
1df00640c9
commit
a52d726bbd
5 changed files with 47 additions and 33 deletions
|
@ -754,9 +754,9 @@ static void do_probe_callback(struct nfs4_client *clp)
|
|||
*/
|
||||
void nfsd4_probe_callback(struct nfs4_client *clp)
|
||||
{
|
||||
/* XXX: atomicity? Also, should we be using cl_cb_flags? */
|
||||
/* XXX: atomicity? Also, should we be using cl_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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue