[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/client/sysint:
client-state-machine.c
CVS commit program
cvs at parl.clemson.edu
Thu Jan 10 11:40:29 EST 2008
Update of /projects/cvsroot/pvfs2-1/src/client/sysint
In directory parlweb1:/tmp/cvs-serv15071/client/sysint
Modified Files:
client-state-machine.c
Log Message:
serialized PINT_client_state_machine_test() and
PINT_client_state_machine_testsome() to fix another big chunk of sysint
thread safety, will revert if remaining fixes get too weird.
Index: client-state-machine.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/client/sysint/client-state-machine.c,v
diff -p -u -r1.90 -r1.91
--- client-state-machine.c 10 Dec 2007 16:13:53 -0000 1.90
+++ client-state-machine.c 10 Jan 2008 16:40:29 -0000 1.91
@@ -36,6 +36,7 @@ job_context_id pint_client_sm_context =
static int s_completion_list_index = 0;
static PINT_smcb *s_completion_list[MAX_RETURNED_JOBS] = {NULL};
static gen_mutex_t s_completion_list_mutex = GEN_MUTEX_INITIALIZER;
+static gen_mutex_t test_mutex = GEN_MUTEX_INITIALIZER;
#define CLIENT_SM_ASSERT_INITIALIZED() \
do { assert(pint_client_sm_context != -1); } while(0)
@@ -574,18 +575,22 @@ PVFS_error PINT_client_state_machine_tes
gossip_debug(GOSSIP_STATE_MACHINE_DEBUG,
"PINT_client_state_machine_test id %lld\n",lld(op_id));
+ gen_mutex_lock(&test_mutex);
+
CLIENT_SM_ASSERT_INITIALIZED();
job_count = MAX_RETURNED_JOBS;
if (!error_code)
{
+ gen_mutex_unlock(&test_mutex);
return ret;
}
smcb = PINT_id_gen_safe_lookup(op_id);
if (!smcb)
{
+ gen_mutex_unlock(&test_mutex);
return ret;
}
@@ -594,6 +599,7 @@ PVFS_error PINT_client_state_machine_tes
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
*error_code = sm_p->error_code;
conditional_remove_sm_if_in_completion_list(smcb);
+ gen_mutex_unlock(&test_mutex);
return 0;
}
@@ -636,6 +642,7 @@ PVFS_error PINT_client_state_machine_tes
*error_code = sm_p->error_code;
conditional_remove_sm_if_in_completion_list(smcb);
}
+ gen_mutex_unlock(&test_mutex);
return 0;
}
@@ -658,17 +665,21 @@ PVFS_error PINT_client_state_machine_tes
job_status_s job_status_array[MAX_RETURNED_JOBS];
void *smcb_p_array[MAX_RETURNED_JOBS] = {NULL};
+ gen_mutex_lock(&test_mutex);
+
CLIENT_SM_ASSERT_INITIALIZED();
if (!op_id_array || !op_count || !error_code_array)
{
PVFS_perror_gossip("PINT_client_state_machine_testsome", ret);
+ gen_mutex_unlock(&test_mutex);
return ret;
}
if ((*op_count < 1) || (*op_count > MAX_RETURNED_JOBS))
{
PVFS_perror_gossip("testsome() got invalid op_count", ret);
+ gen_mutex_unlock(&test_mutex);
return ret;
}
@@ -683,6 +694,7 @@ PVFS_error PINT_client_state_machine_tes
/* return them if found */
if ((ret == 0) && (*op_count > 0))
{
+ gen_mutex_unlock(&test_mutex);
return ret;
}
@@ -718,8 +730,10 @@ PVFS_error PINT_client_state_machine_tes
}
/* terminated SMs have added themselves to the completion list */
- return completion_list_retrieve_completed(
+ ret = completion_list_retrieve_completed(
op_id_array, user_ptr_array, error_code_array, limit, op_count);
+ gen_mutex_unlock(&test_mutex);
+ return(ret);
}
/** Continually test on a specific state machine until it completes.
More information about the Pvfs2-cvs
mailing list