aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
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
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')
-rw-r--r--fs/nfs/nfs4proc.c18
-rw-r--r--fs/nfs/nfs4xdr.c4
2 files changed, 20 insertions, 2 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);
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 05d34f1fcc19..a67040f51597 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -5550,8 +5550,8 @@ static int decode_sequence(struct xdr_stream *xdr,
5550 dprintk("%s Invalid slot id\n", __func__); 5550 dprintk("%s Invalid slot id\n", __func__);
5551 goto out_err; 5551 goto out_err;
5552 } 5552 }
5553 /* highest slot id - currently not processed */ 5553 /* highest slot id */
5554 dummy = be32_to_cpup(p++); 5554 res->sr_highest_slotid = be32_to_cpup(p++);
5555 /* target highest slot id */ 5555 /* target highest slot id */
5556 res->sr_target_highest_slotid = be32_to_cpup(p++); 5556 res->sr_target_highest_slotid = be32_to_cpup(p++);
5557 /* result flags */ 5557 /* result flags */