aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2009-04-01 09:22:37 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 15:25:05 -0400
commitac72b7b3b3263ce64d55094eac1d1bde5f34e64a (patch)
tree2ecd6882caab65e33dad8cda06a71da2e6293279 /fs/nfs/nfs4proc.c
parentfc01cea963a246742ff15e118ce5259e3091352c (diff)
nfs41: reset the session slot table
Separated from nfs41: schedule async session reset Do not kfree the session slot table upon session reset, just re-initialize it. Add a boolean to nfs4_proc_create_session to inidicate if this is a session reset or a session initialization. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 17768095f0cc..0b1214740248 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4289,6 +4289,37 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
4289 return status; 4289 return status;
4290} 4290}
4291 4291
4292/* Reset a slot table */
4293static int nfs4_reset_slot_table(struct nfs4_session *session)
4294{
4295 struct nfs4_slot_table *tbl = &session->fc_slot_table;
4296 int i, max_slots = session->fc_attrs.max_reqs;
4297 int old_max_slots = session->fc_slot_table.max_slots;
4298 int ret = 0;
4299
4300 dprintk("--> %s: max_reqs=%u, tbl %p\n", __func__,
4301 session->fc_attrs.max_reqs, tbl);
4302
4303 /* Until we have dynamic slot table adjustment, insist
4304 * upon the same slot table size */
4305 if (max_slots != old_max_slots) {
4306 dprintk("%s reset slot table does't match old\n",
4307 __func__);
4308 ret = -EINVAL; /*XXX NFS4ERR_REQ_TOO_BIG ? */
4309 goto out;
4310 }
4311 spin_lock(&tbl->slot_tbl_lock);
4312 for (i = 0; i < max_slots; ++i)
4313 tbl->slots[i].seq_nr = 1;
4314 tbl->highest_used_slotid = -1;
4315 spin_unlock(&tbl->slot_tbl_lock);
4316 dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__,
4317 tbl, tbl->slots, tbl->max_slots);
4318out:
4319 dprintk("<-- %s: return %d\n", __func__, ret);
4320 return ret;
4321}
4322
4292/* 4323/*
4293 * Initialize slot table 4324 * Initialize slot table
4294 */ 4325 */
@@ -4497,7 +4528,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp)
4497 * It is the responsibility of the caller to verify the session is 4528 * It is the responsibility of the caller to verify the session is
4498 * expired before calling this routine. 4529 * expired before calling this routine.
4499 */ 4530 */
4500int nfs4_proc_create_session(struct nfs_client *clp) 4531int nfs4_proc_create_session(struct nfs_client *clp, int reset)
4501{ 4532{
4502 int status; 4533 int status;
4503 unsigned *ptr; 4534 unsigned *ptr;
@@ -4510,8 +4541,11 @@ int nfs4_proc_create_session(struct nfs_client *clp)
4510 if (status) 4541 if (status)
4511 goto out; 4542 goto out;
4512 4543
4513 /* Init the fore channel */ 4544 /* Init or reset the fore channel */
4514 status = nfs4_init_slot_table(session); 4545 if (reset)
4546 status = nfs4_reset_slot_table(session);
4547 else
4548 status = nfs4_init_slot_table(session);
4515 dprintk("fore channel slot table initialization returned %d\n", status); 4549 dprintk("fore channel slot table initialization returned %d\n", status);
4516 if (status) 4550 if (status)
4517 goto out; 4551 goto out;
@@ -4520,6 +4554,10 @@ int nfs4_proc_create_session(struct nfs_client *clp)
4520 dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, 4554 dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__,
4521 clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); 4555 clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]);
4522 4556
4557 if (reset)
4558 /* Lease time is aleady set */
4559 goto out;
4560
4523 /* Get the lease time */ 4561 /* Get the lease time */
4524 status = nfs4_proc_get_lease_time(clp, &fsinfo); 4562 status = nfs4_proc_get_lease_time(clp, &fsinfo);
4525 if (status == 0) { 4563 if (status == 0) {