aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-20 18:10:30 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-05 18:30:17 -0500
commitda0507b7c95ccd4d9c86394eef42fe076032af30 (patch)
tree3cbbc9e94b85183e64f14a37732bd1011817032d /fs/nfs/nfs4proc.c
parent464ee9f966404786ba4c6be35dc8362ee8e6ba4e (diff)
NFSv4.1: Reset the sequence number for slots that have been deallocated
When the server tells us that it is dynamically resizing the session replay cache, we should reset the sequence number for those slots that have been deallocated. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d91abaa522e8..52435ec44193 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -498,6 +498,22 @@ static void nfs41_set_target_slotid_locked(struct nfs4_slot_table *tbl,
498 tbl->generation++; 498 tbl->generation++;
499} 499}
500 500
501static void nfs41_set_server_slotid_locked(struct nfs4_slot_table *tbl,
502 u32 highest_slotid)
503{
504 unsigned int max_slotid, i;
505
506 if (tbl->server_highest_slotid == highest_slotid)
507 return;
508 if (tbl->highest_used_slotid > highest_slotid)
509 return;
510 max_slotid = min(tbl->max_slots - 1, highest_slotid);
511 /* Reset the seq_nr for deallocated slots */
512 for (i = tbl->server_highest_slotid + 1; i <= max_slotid; i++)
513 tbl->slots[i].seq_nr = 1;
514 tbl->server_highest_slotid = highest_slotid;
515}
516
501static void nfs41_update_target_slotid(struct nfs4_slot_table *tbl, 517static void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
502 struct nfs4_slot *slot, 518 struct nfs4_slot *slot,
503 struct nfs4_sequence_res *res) 519 struct nfs4_sequence_res *res)
@@ -505,6 +521,7 @@ static void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
505 spin_lock(&tbl->slot_tbl_lock); 521 spin_lock(&tbl->slot_tbl_lock);
506 if (tbl->generation != slot->generation) 522 if (tbl->generation != slot->generation)
507 goto out; 523 goto out;
524 nfs41_set_server_slotid_locked(tbl, res->sr_highest_slotid);
508 nfs41_set_target_slotid_locked(tbl, res->sr_target_highest_slotid); 525 nfs41_set_target_slotid_locked(tbl, res->sr_target_highest_slotid);
509out: 526out:
510 spin_unlock(&tbl->slot_tbl_lock); 527 spin_unlock(&tbl->slot_tbl_lock);
@@ -5718,6 +5735,7 @@ static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl,
5718 } 5735 }
5719 tbl->highest_used_slotid = NFS4_NO_SLOT; 5736 tbl->highest_used_slotid = NFS4_NO_SLOT;
5720 tbl->target_highest_slotid = max_slots - 1; 5737 tbl->target_highest_slotid = max_slots - 1;
5738 tbl->server_highest_slotid = max_slots - 1;
5721 for (i = 0; i < tbl->max_slots; i++) 5739 for (i = 0; i < tbl->max_slots; i++)
5722 tbl->slots[i].seq_nr = ivalue; 5740 tbl->slots[i].seq_nr = ivalue;
5723 spin_unlock(&tbl->slot_tbl_lock); 5741 spin_unlock(&tbl->slot_tbl_lock);