Skip to content

Commit e3fd54e

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
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: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent a10a923 commit e3fd54e

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

fs/nfs/callback.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ enum nfs4_callback_opnum {
4040

4141
struct nfs4_slot;
4242
struct cb_process_state {
43-
__be32 drc_status;
4443
struct nfs_client *clp;
4544
struct nfs4_slot *slot;
46-
u32 minorversion;
4745
struct net *net;
46+
u32 minorversion;
47+
__be32 drc_status;
48+
unsigned int referring_calls;
4849
};
4950

5051
struct cb_compound_hdr_arg {

fs/nfs/callback_proc.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ static int referring_call_exists(struct nfs_client *clp,
450450
__acquires(lock)
451451
{
452452
int status = 0;
453+
int found = 0;
453454
int i, j;
454455
struct nfs4_session *session;
455456
struct nfs4_slot_table *tbl;
@@ -478,11 +479,12 @@ static int referring_call_exists(struct nfs_client *clp,
478479
spin_lock(lock);
479480
if (status)
480481
goto out;
482+
found++;
481483
}
482484
}
483485

484486
out:
485-
return status;
487+
return status < 0 ? status : found;
486488
}
487489

488490
__be32 nfs4_callback_sequence(void *argp, void *resp,
@@ -493,6 +495,7 @@ __be32 nfs4_callback_sequence(void *argp, void *resp,
493495
struct nfs4_slot_table *tbl;
494496
struct nfs4_slot *slot;
495497
struct nfs_client *clp;
498+
int ret;
496499
int i;
497500
__be32 status = htonl(NFS4ERR_BADSESSION);
498501

@@ -552,11 +555,13 @@ __be32 nfs4_callback_sequence(void *argp, void *resp,
552555
* related callback was received before the response to the original
553556
* call.
554557
*/
555-
if (referring_call_exists(clp, args->csa_nrclists, args->csa_rclists,
556-
&tbl->slot_tbl_lock) < 0) {
558+
ret = referring_call_exists(clp, args->csa_nrclists, args->csa_rclists,
559+
&tbl->slot_tbl_lock);
560+
if (ret < 0) {
557561
status = htonl(NFS4ERR_DELAY);
558562
goto out_unlock;
559563
}
564+
cps->referring_calls = ret;
560565

561566
/*
562567
* RFC5661 20.9.3

0 commit comments

Comments
 (0)