diff options
author | Andy Adamson <andros@netapp.com> | 2010-01-14 17:45:10 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-02-10 08:30:59 -0500 |
commit | 104aeba484c9291cde2def6d037b836af46d8eb0 (patch) | |
tree | 5f6be578487470e345ce1516d8f7c5e230d54868 /fs | |
parent | b9efa1b27e25b1286504973c0a6bf0f24106faa8 (diff) |
nfs41: resize slot table in reset
When session is reset, client can renegotiate slot table size.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b829118c7e04..84b53d38f50b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4618,26 +4618,32 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo) | |||
4618 | /* | 4618 | /* |
4619 | * Reset a slot table | 4619 | * Reset a slot table |
4620 | */ | 4620 | */ |
4621 | static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, int max_slots, | 4621 | static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs, |
4622 | int old_max_slots, int ivalue) | 4622 | int ivalue) |
4623 | { | 4623 | { |
4624 | struct nfs4_slot *new = NULL; | ||
4624 | int i; | 4625 | int i; |
4625 | int ret = 0; | 4626 | int ret = 0; |
4626 | 4627 | ||
4627 | dprintk("--> %s: max_reqs=%u, tbl %p\n", __func__, max_slots, tbl); | 4628 | dprintk("--> %s: max_reqs=%u, tbl->max_slots %d\n", __func__, |
4629 | max_reqs, tbl->max_slots); | ||
4628 | 4630 | ||
4629 | /* | 4631 | /* Does the newly negotiated max_reqs match the existing slot table? */ |
4630 | * Until we have dynamic slot table adjustment, insist | 4632 | if (max_reqs != tbl->max_slots) { |
4631 | * upon the same slot table size | 4633 | ret = -ENOMEM; |
4632 | */ | 4634 | new = kmalloc(max_reqs * sizeof(struct nfs4_slot), |
4633 | if (max_slots != old_max_slots) { | 4635 | GFP_KERNEL); |
4634 | dprintk("%s reset slot table does't match old\n", | 4636 | if (!new) |
4635 | __func__); | 4637 | goto out; |
4636 | ret = -EINVAL; /*XXX NFS4ERR_REQ_TOO_BIG ? */ | 4638 | ret = 0; |
4637 | goto out; | 4639 | kfree(tbl->slots); |
4638 | } | 4640 | } |
4639 | spin_lock(&tbl->slot_tbl_lock); | 4641 | spin_lock(&tbl->slot_tbl_lock); |
4640 | for (i = 0; i < max_slots; ++i) | 4642 | if (new) { |
4643 | tbl->slots = new; | ||
4644 | tbl->max_slots = max_reqs; | ||
4645 | } | ||
4646 | for (i = 0; i < tbl->max_slots; ++i) | ||
4641 | tbl->slots[i].seq_nr = ivalue; | 4647 | tbl->slots[i].seq_nr = ivalue; |
4642 | spin_unlock(&tbl->slot_tbl_lock); | 4648 | spin_unlock(&tbl->slot_tbl_lock); |
4643 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, | 4649 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, |
@@ -4655,16 +4661,12 @@ static int nfs4_reset_slot_tables(struct nfs4_session *session) | |||
4655 | int status; | 4661 | int status; |
4656 | 4662 | ||
4657 | status = nfs4_reset_slot_table(&session->fc_slot_table, | 4663 | status = nfs4_reset_slot_table(&session->fc_slot_table, |
4658 | session->fc_attrs.max_reqs, | 4664 | session->fc_attrs.max_reqs, 1); |
4659 | session->fc_slot_table.max_slots, | ||
4660 | 1); | ||
4661 | if (status) | 4665 | if (status) |
4662 | return status; | 4666 | return status; |
4663 | 4667 | ||
4664 | status = nfs4_reset_slot_table(&session->bc_slot_table, | 4668 | status = nfs4_reset_slot_table(&session->bc_slot_table, |
4665 | session->bc_attrs.max_reqs, | 4669 | session->bc_attrs.max_reqs, 0); |
4666 | session->bc_slot_table.max_slots, | ||
4667 | 0); | ||
4668 | return status; | 4670 | return status; |
4669 | } | 4671 | } |
4670 | 4672 | ||