diff options
-rw-r--r-- | fs/nfs/nfs4_fs.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 60 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 4 |
3 files changed, 27 insertions, 39 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 90923223a7c1..50dd55069d3d 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -222,7 +222,7 @@ extern int nfs4_setup_sequence(struct nfs_client *clp, | |||
222 | int cache_reply, struct rpc_task *task); | 222 | int cache_reply, struct rpc_task *task); |
223 | extern void nfs4_destroy_session(struct nfs4_session *session); | 223 | extern void nfs4_destroy_session(struct nfs4_session *session); |
224 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); | 224 | extern struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp); |
225 | extern int nfs4_proc_create_session(struct nfs_client *, int reset); | 225 | extern int nfs4_proc_create_session(struct nfs_client *); |
226 | extern int nfs4_proc_destroy_session(struct nfs4_session *); | 226 | extern int nfs4_proc_destroy_session(struct nfs4_session *); |
227 | extern int nfs4_init_session(struct nfs_server *server); | 227 | extern int nfs4_init_session(struct nfs_server *server); |
228 | #else /* CONFIG_NFS_v4_1 */ | 228 | #else /* CONFIG_NFS_v4_1 */ |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 206ce30a595d..be96d28baccf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4501,7 +4501,6 @@ static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, int max_slots, | |||
4501 | spin_lock(&tbl->slot_tbl_lock); | 4501 | spin_lock(&tbl->slot_tbl_lock); |
4502 | for (i = 0; i < max_slots; ++i) | 4502 | for (i = 0; i < max_slots; ++i) |
4503 | tbl->slots[i].seq_nr = ivalue; | 4503 | tbl->slots[i].seq_nr = ivalue; |
4504 | tbl->highest_used_slotid = -1; | ||
4505 | spin_unlock(&tbl->slot_tbl_lock); | 4504 | spin_unlock(&tbl->slot_tbl_lock); |
4506 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, | 4505 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, |
4507 | tbl, tbl->slots, tbl->max_slots); | 4506 | tbl, tbl->slots, tbl->max_slots); |
@@ -4552,7 +4551,6 @@ static void nfs4_destroy_slot_tables(struct nfs4_session *session) | |||
4552 | static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, | 4551 | static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, |
4553 | int max_slots, int ivalue) | 4552 | int max_slots, int ivalue) |
4554 | { | 4553 | { |
4555 | int i; | ||
4556 | struct nfs4_slot *slot; | 4554 | struct nfs4_slot *slot; |
4557 | int ret = -ENOMEM; | 4555 | int ret = -ENOMEM; |
4558 | 4556 | ||
@@ -4563,18 +4561,9 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, | |||
4563 | slot = kcalloc(max_slots, sizeof(struct nfs4_slot), GFP_KERNEL); | 4561 | slot = kcalloc(max_slots, sizeof(struct nfs4_slot), GFP_KERNEL); |
4564 | if (!slot) | 4562 | if (!slot) |
4565 | goto out; | 4563 | goto out; |
4566 | for (i = 0; i < max_slots; ++i) | ||
4567 | slot[i].seq_nr = ivalue; | ||
4568 | ret = 0; | 4564 | ret = 0; |
4569 | 4565 | ||
4570 | spin_lock(&tbl->slot_tbl_lock); | 4566 | spin_lock(&tbl->slot_tbl_lock); |
4571 | if (tbl->slots != NULL) { | ||
4572 | spin_unlock(&tbl->slot_tbl_lock); | ||
4573 | dprintk("%s: slot table already initialized. tbl=%p slots=%p\n", | ||
4574 | __func__, tbl, tbl->slots); | ||
4575 | WARN_ON(1); | ||
4576 | goto out_free; | ||
4577 | } | ||
4578 | tbl->max_slots = max_slots; | 4567 | tbl->max_slots = max_slots; |
4579 | tbl->slots = slot; | 4568 | tbl->slots = slot; |
4580 | tbl->highest_used_slotid = -1; /* no slot is currently used */ | 4569 | tbl->highest_used_slotid = -1; /* no slot is currently used */ |
@@ -4584,10 +4573,6 @@ static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, | |||
4584 | out: | 4573 | out: |
4585 | dprintk("<-- %s: return %d\n", __func__, ret); | 4574 | dprintk("<-- %s: return %d\n", __func__, ret); |
4586 | return ret; | 4575 | return ret; |
4587 | |||
4588 | out_free: | ||
4589 | kfree(slot); | ||
4590 | goto out; | ||
4591 | } | 4576 | } |
4592 | 4577 | ||
4593 | /* | 4578 | /* |
@@ -4595,17 +4580,24 @@ out_free: | |||
4595 | */ | 4580 | */ |
4596 | static int nfs4_init_slot_tables(struct nfs4_session *session) | 4581 | static int nfs4_init_slot_tables(struct nfs4_session *session) |
4597 | { | 4582 | { |
4598 | int status; | 4583 | struct nfs4_slot_table *tbl; |
4584 | int status = 0; | ||
4599 | 4585 | ||
4600 | status = nfs4_init_slot_table(&session->fc_slot_table, | 4586 | tbl = &session->fc_slot_table; |
4601 | session->fc_attrs.max_reqs, 1); | 4587 | if (tbl->slots == NULL) { |
4602 | if (status) | 4588 | status = nfs4_init_slot_table(tbl, |
4603 | return status; | 4589 | session->fc_attrs.max_reqs, 1); |
4590 | if (status) | ||
4591 | return status; | ||
4592 | } | ||
4604 | 4593 | ||
4605 | status = nfs4_init_slot_table(&session->bc_slot_table, | 4594 | tbl = &session->bc_slot_table; |
4606 | session->bc_attrs.max_reqs, 0); | 4595 | if (tbl->slots == NULL) { |
4607 | if (status) | 4596 | status = nfs4_init_slot_table(tbl, |
4608 | nfs4_destroy_slot_tables(session); | 4597 | session->bc_attrs.max_reqs, 0); |
4598 | if (status) | ||
4599 | nfs4_destroy_slot_tables(session); | ||
4600 | } | ||
4609 | 4601 | ||
4610 | return status; | 4602 | return status; |
4611 | } | 4603 | } |
@@ -4784,7 +4776,7 @@ static int _nfs4_proc_create_session(struct nfs_client *clp) | |||
4784 | * It is the responsibility of the caller to verify the session is | 4776 | * It is the responsibility of the caller to verify the session is |
4785 | * expired before calling this routine. | 4777 | * expired before calling this routine. |
4786 | */ | 4778 | */ |
4787 | int nfs4_proc_create_session(struct nfs_client *clp, int reset) | 4779 | int nfs4_proc_create_session(struct nfs_client *clp) |
4788 | { | 4780 | { |
4789 | int status; | 4781 | int status; |
4790 | unsigned *ptr; | 4782 | unsigned *ptr; |
@@ -4797,12 +4789,13 @@ int nfs4_proc_create_session(struct nfs_client *clp, int reset) | |||
4797 | if (status) | 4789 | if (status) |
4798 | goto out; | 4790 | goto out; |
4799 | 4791 | ||
4800 | /* Init or reset the fore channel */ | 4792 | /* Init and reset the fore channel */ |
4801 | if (reset) | 4793 | status = nfs4_init_slot_tables(session); |
4802 | status = nfs4_reset_slot_tables(session); | 4794 | dprintk("slot table initialization returned %d\n", status); |
4803 | else | 4795 | if (status) |
4804 | status = nfs4_init_slot_tables(session); | 4796 | goto out; |
4805 | dprintk("fore channel slot table initialization returned %d\n", status); | 4797 | status = nfs4_reset_slot_tables(session); |
4798 | dprintk("slot table reset returned %d\n", status); | ||
4806 | if (status) | 4799 | if (status) |
4807 | goto out; | 4800 | goto out; |
4808 | 4801 | ||
@@ -4810,10 +4803,6 @@ int nfs4_proc_create_session(struct nfs_client *clp, int reset) | |||
4810 | dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, | 4803 | dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, |
4811 | clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); | 4804 | clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); |
4812 | 4805 | ||
4813 | if (reset) | ||
4814 | /* Lease time is aleady set */ | ||
4815 | goto out; | ||
4816 | |||
4817 | /* Get the lease time */ | 4806 | /* Get the lease time */ |
4818 | status = nfs4_proc_get_lease_time(clp, &fsinfo); | 4807 | status = nfs4_proc_get_lease_time(clp, &fsinfo); |
4819 | if (status == 0) { | 4808 | if (status == 0) { |
@@ -4821,7 +4810,6 @@ int nfs4_proc_create_session(struct nfs_client *clp, int reset) | |||
4821 | spin_lock(&clp->cl_lock); | 4810 | spin_lock(&clp->cl_lock); |
4822 | clp->cl_lease_time = fsinfo.lease_time * HZ; | 4811 | clp->cl_lease_time = fsinfo.lease_time * HZ; |
4823 | clp->cl_last_renewal = jiffies; | 4812 | clp->cl_last_renewal = jiffies; |
4824 | clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | ||
4825 | spin_unlock(&clp->cl_lock); | 4813 | spin_unlock(&clp->cl_lock); |
4826 | 4814 | ||
4827 | nfs4_schedule_state_renewal(clp); | 4815 | nfs4_schedule_state_renewal(clp); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 873dda7fec3e..37f020eb92f2 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -123,7 +123,7 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) | |||
123 | status = nfs4_proc_exchange_id(clp, cred); | 123 | status = nfs4_proc_exchange_id(clp, cred); |
124 | if (status == 0) | 124 | if (status == 0) |
125 | /* create session schedules state renewal upon success */ | 125 | /* create session schedules state renewal upon success */ |
126 | status = nfs4_proc_create_session(clp, 0); | 126 | status = nfs4_proc_create_session(clp); |
127 | if (status == 0) | 127 | if (status == 0) |
128 | nfs_mark_client_ready(clp, NFS_CS_READY); | 128 | nfs_mark_client_ready(clp, NFS_CS_READY); |
129 | return status; | 129 | return status; |
@@ -1240,7 +1240,7 @@ static int nfs4_reset_session(struct nfs_client *clp) | |||
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN); | 1242 | memset(clp->cl_session->sess_id.data, 0, NFS4_MAX_SESSIONID_LEN); |
1243 | status = nfs4_proc_create_session(clp, 1); | 1243 | status = nfs4_proc_create_session(clp); |
1244 | if (status) | 1244 | if (status) |
1245 | nfs4_session_recovery_handle_error(clp, status); | 1245 | nfs4_session_recovery_handle_error(clp, status); |
1246 | /* fall through*/ | 1246 | /* fall through*/ |