mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
b9efa1b27e
commit
104aeba484
|
@ -4618,26 +4618,32 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
|
||||||
/*
|
/*
|
||||||
* Reset a slot table
|
* Reset a slot table
|
||||||
*/
|
*/
|
||||||
static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, int max_slots,
|
static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs,
|
||||||
int old_max_slots, int ivalue)
|
int ivalue)
|
||||||
{
|
{
|
||||||
|
struct nfs4_slot *new = NULL;
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
dprintk("--> %s: max_reqs=%u, tbl %p\n", __func__, max_slots, tbl);
|
dprintk("--> %s: max_reqs=%u, tbl->max_slots %d\n", __func__,
|
||||||
|
max_reqs, tbl->max_slots);
|
||||||
|
|
||||||
/*
|
/* Does the newly negotiated max_reqs match the existing slot table? */
|
||||||
* Until we have dynamic slot table adjustment, insist
|
if (max_reqs != tbl->max_slots) {
|
||||||
* upon the same slot table size
|
ret = -ENOMEM;
|
||||||
*/
|
new = kmalloc(max_reqs * sizeof(struct nfs4_slot),
|
||||||
if (max_slots != old_max_slots) {
|
GFP_KERNEL);
|
||||||
dprintk("%s reset slot table does't match old\n",
|
if (!new)
|
||||||
__func__);
|
goto out;
|
||||||
ret = -EINVAL; /*XXX NFS4ERR_REQ_TOO_BIG ? */
|
ret = 0;
|
||||||
goto out;
|
kfree(tbl->slots);
|
||||||
}
|
}
|
||||||
spin_lock(&tbl->slot_tbl_lock);
|
spin_lock(&tbl->slot_tbl_lock);
|
||||||
for (i = 0; i < max_slots; ++i)
|
if (new) {
|
||||||
|
tbl->slots = new;
|
||||||
|
tbl->max_slots = max_reqs;
|
||||||
|
}
|
||||||
|
for (i = 0; i < tbl->max_slots; ++i)
|
||||||
tbl->slots[i].seq_nr = ivalue;
|
tbl->slots[i].seq_nr = ivalue;
|
||||||
spin_unlock(&tbl->slot_tbl_lock);
|
spin_unlock(&tbl->slot_tbl_lock);
|
||||||
dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__,
|
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)
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = nfs4_reset_slot_table(&session->fc_slot_table,
|
status = nfs4_reset_slot_table(&session->fc_slot_table,
|
||||||
session->fc_attrs.max_reqs,
|
session->fc_attrs.max_reqs, 1);
|
||||||
session->fc_slot_table.max_slots,
|
|
||||||
1);
|
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
status = nfs4_reset_slot_table(&session->bc_slot_table,
|
status = nfs4_reset_slot_table(&session->bc_slot_table,
|
||||||
session->bc_attrs.max_reqs,
|
session->bc_attrs.max_reqs, 0);
|
||||||
session->bc_slot_table.max_slots,
|
|
||||||
0);
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue