diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a7b1d6c228cd..c3019ad85893 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4420,23 +4420,22 @@ static int nfs4_reset_slot_tables(struct nfs4_session *session) | |||
4420 | /* | 4420 | /* |
4421 | * Initialize slot table | 4421 | * Initialize slot table |
4422 | */ | 4422 | */ |
4423 | static int nfs4_init_slot_table(struct nfs4_session *session) | 4423 | static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, |
4424 | int max_slots, int ivalue) | ||
4424 | { | 4425 | { |
4425 | struct nfs4_slot_table *tbl = &session->fc_slot_table; | 4426 | int i; |
4426 | int i, max_slots = session->fc_attrs.max_reqs; | ||
4427 | struct nfs4_slot *slot; | 4427 | struct nfs4_slot *slot; |
4428 | int ret = -ENOMEM; | 4428 | int ret = -ENOMEM; |
4429 | 4429 | ||
4430 | BUG_ON(max_slots > NFS4_MAX_SLOT_TABLE); | 4430 | BUG_ON(max_slots > NFS4_MAX_SLOT_TABLE); |
4431 | 4431 | ||
4432 | dprintk("--> %s: max_reqs=%u\n", __func__, | 4432 | dprintk("--> %s: max_reqs=%u\n", __func__, max_slots); |
4433 | session->fc_attrs.max_reqs); | ||
4434 | 4433 | ||
4435 | slot = kcalloc(max_slots, sizeof(struct nfs4_slot), GFP_KERNEL); | 4434 | slot = kcalloc(max_slots, sizeof(struct nfs4_slot), GFP_KERNEL); |
4436 | if (!slot) | 4435 | if (!slot) |
4437 | goto out; | 4436 | goto out; |
4438 | for (i = 0; i < max_slots; ++i) | 4437 | for (i = 0; i < max_slots; ++i) |
4439 | slot[i].seq_nr = 1; | 4438 | slot[i].seq_nr = ivalue; |
4440 | ret = 0; | 4439 | ret = 0; |
4441 | 4440 | ||
4442 | spin_lock(&tbl->slot_tbl_lock); | 4441 | spin_lock(&tbl->slot_tbl_lock); |
@@ -4456,11 +4455,24 @@ static int nfs4_init_slot_table(struct nfs4_session *session) | |||
4456 | out: | 4455 | out: |
4457 | dprintk("<-- %s: return %d\n", __func__, ret); | 4456 | dprintk("<-- %s: return %d\n", __func__, ret); |
4458 | return ret; | 4457 | return ret; |
4458 | |||
4459 | out_free: | 4459 | out_free: |
4460 | kfree(slot); | 4460 | kfree(slot); |
4461 | goto out; | 4461 | goto out; |
4462 | } | 4462 | } |
4463 | 4463 | ||
4464 | /* | ||
4465 | * Initialize the forechannel and backchannel tables | ||
4466 | */ | ||
4467 | static int nfs4_init_slot_tables(struct nfs4_session *session) | ||
4468 | { | ||
4469 | int status; | ||
4470 | |||
4471 | status = nfs4_init_slot_table(&session->fc_slot_table, | ||
4472 | session->fc_attrs.max_reqs, 1); | ||
4473 | return status; | ||
4474 | } | ||
4475 | |||
4464 | /* Destroy the slot table */ | 4476 | /* Destroy the slot table */ |
4465 | static void nfs4_destroy_slot_table(struct nfs4_session *session) | 4477 | static void nfs4_destroy_slot_table(struct nfs4_session *session) |
4466 | { | 4478 | { |
@@ -4657,7 +4669,7 @@ int nfs4_proc_create_session(struct nfs_client *clp, int reset) | |||
4657 | if (reset) | 4669 | if (reset) |
4658 | status = nfs4_reset_slot_tables(session); | 4670 | status = nfs4_reset_slot_tables(session); |
4659 | else | 4671 | else |
4660 | status = nfs4_init_slot_table(session); | 4672 | status = nfs4_init_slot_tables(session); |
4661 | dprintk("fore channel slot table initialization returned %d\n", status); | 4673 | dprintk("fore channel slot table initialization returned %d\n", status); |
4662 | if (status) | 4674 | if (status) |
4663 | goto out; | 4675 | goto out; |