Skip to content

Commit 07e8dcb

Browse files
committed
NFSv4.1: Defer bumping the slot sequence number until we free the slot
For operations like OPEN or LAYOUTGET, which return recallable state (i.e. delegations and layouts) we want to enable the mechanism for resolving recall races in RFC5661 Section 2.10.6.3. To do so, we will want to defer bumping the slot's sequence number until we have finished processing the RPC results. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
1 parent 045d2a6 commit 07e8dcb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

fs/nfs/nfs4proc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
666666
tbl = slot->table;
667667
session = tbl->session;
668668

669+
/* Bump the slot sequence number */
670+
if (slot->seq_done)
671+
slot->seq_nr++;
672+
slot->seq_done = 0;
673+
669674
spin_lock(&tbl->slot_tbl_lock);
670675
/* Be nice to the server: try to ensure that the last transmitted
671676
* value for highest_user_slotid <= target_highest_slotid
@@ -716,7 +721,7 @@ int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
716721
switch (res->sr_status) {
717722
case 0:
718723
/* Update the slot's sequence and clientid lease timer */
719-
++slot->seq_nr;
724+
slot->seq_done = 1;
720725
clp = session->clp;
721726
do_renew_lease(clp, res->sr_timestamp);
722727
/* Check sequence flags */
@@ -771,7 +776,7 @@ int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
771776
goto retry_nowait;
772777
default:
773778
/* Just update the slot sequence no. */
774-
++slot->seq_nr;
779+
slot->seq_done = 1;
775780
}
776781
out:
777782
/* The session may be reset by one of the error handlers. */

fs/nfs/nfs4session.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ struct nfs4_slot {
2121
unsigned long generation;
2222
u32 slot_nr;
2323
u32 seq_nr;
24-
unsigned int interrupted : 1;
24+
unsigned int interrupted : 1,
25+
seq_done : 1;
2526
};
2627

2728
/* Sessions */

0 commit comments

Comments
 (0)