Commit e3fd54e7 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

NFSv4: Track the number of referring calls in struct cb_process_state

When the server gives us a set of referring calls, to tell us that the
NFSv4.1 callback needs to be ordered with respect to those calls, then
we may want to make that information available to the operations. In
certain cases, it may allow them to optimise their behaviour due to the
extra knowledge.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent a10a9233
...@@ -40,11 +40,12 @@ enum nfs4_callback_opnum { ...@@ -40,11 +40,12 @@ enum nfs4_callback_opnum {
struct nfs4_slot; struct nfs4_slot;
struct cb_process_state { struct cb_process_state {
__be32 drc_status;
struct nfs_client *clp; struct nfs_client *clp;
struct nfs4_slot *slot; struct nfs4_slot *slot;
u32 minorversion;
struct net *net; struct net *net;
u32 minorversion;
__be32 drc_status;
unsigned int referring_calls;
}; };
struct cb_compound_hdr_arg { struct cb_compound_hdr_arg {
......
...@@ -450,6 +450,7 @@ static int referring_call_exists(struct nfs_client *clp, ...@@ -450,6 +450,7 @@ static int referring_call_exists(struct nfs_client *clp,
__acquires(lock) __acquires(lock)
{ {
int status = 0; int status = 0;
int found = 0;
int i, j; int i, j;
struct nfs4_session *session; struct nfs4_session *session;
struct nfs4_slot_table *tbl; struct nfs4_slot_table *tbl;
...@@ -478,11 +479,12 @@ static int referring_call_exists(struct nfs_client *clp, ...@@ -478,11 +479,12 @@ static int referring_call_exists(struct nfs_client *clp,
spin_lock(lock); spin_lock(lock);
if (status) if (status)
goto out; goto out;
found++;
} }
} }
out: out:
return status; return status < 0 ? status : found;
} }
__be32 nfs4_callback_sequence(void *argp, void *resp, __be32 nfs4_callback_sequence(void *argp, void *resp,
...@@ -493,6 +495,7 @@ __be32 nfs4_callback_sequence(void *argp, void *resp, ...@@ -493,6 +495,7 @@ __be32 nfs4_callback_sequence(void *argp, void *resp,
struct nfs4_slot_table *tbl; struct nfs4_slot_table *tbl;
struct nfs4_slot *slot; struct nfs4_slot *slot;
struct nfs_client *clp; struct nfs_client *clp;
int ret;
int i; int i;
__be32 status = htonl(NFS4ERR_BADSESSION); __be32 status = htonl(NFS4ERR_BADSESSION);
...@@ -552,11 +555,13 @@ __be32 nfs4_callback_sequence(void *argp, void *resp, ...@@ -552,11 +555,13 @@ __be32 nfs4_callback_sequence(void *argp, void *resp,
* related callback was received before the response to the original * related callback was received before the response to the original
* call. * call.
*/ */
if (referring_call_exists(clp, args->csa_nrclists, args->csa_rclists, ret = referring_call_exists(clp, args->csa_nrclists, args->csa_rclists,
&tbl->slot_tbl_lock) < 0) { &tbl->slot_tbl_lock);
if (ret < 0) {
status = htonl(NFS4ERR_DELAY); status = htonl(NFS4ERR_DELAY);
goto out_unlock; goto out_unlock;
} }
cps->referring_calls = ret;
/* /*
* RFC5661 20.9.3 * RFC5661 20.9.3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment