[PVFS2-CVS] commit by pcarns in pvfs2/src/io/flow/flowproto-bmi-trove: flowproto-multiqueue.c

CVS commit program cvs at parl.clemson.edu
Fri Feb 13 10:24:59 EST 2004


Update of /projects/cvsroot/pvfs2/src/io/flow/flowproto-bmi-trove
In directory parlweb:/tmp/cvs-serv13971

Modified Files:
	flowproto-multiqueue.c 
Log Message:
make sure that the cleanup functions get rid of some data structures that 
were allocated if an error makes us miss the normal path, also better tracking
of trove ids


Index: flowproto-multiqueue.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/flow/flowproto-bmi-trove/flowproto-multiqueue.c,v
diff -p -u -r1.55 -r1.56
--- flowproto-multiqueue.c	13 Feb 2004 01:19:09 -0000	1.55
+++ flowproto-multiqueue.c	13 Feb 2004 15:24:58 -0000	1.56
@@ -52,6 +52,7 @@ do{								\
 
 struct result_chain_entry
 {
+    PVFS_id_gen_t posted_id;
     void* buffer_offset;
     PINT_Request_result result;
     PVFS_size size_list[MAX_REGIONS];
@@ -399,6 +400,7 @@ static void bmi_recv_callback_fn(void *u
     result_tmp = &q_item->result_chain;
     do{
 	assert(result_tmp->result.bytes);
+	q_item->posted_id = 0;
 	ret = trove_bstream_write_list(q_item->parent->dest.u.trove.coll_id,
 	    q_item->parent->dest.u.trove.handle,
 	    (char**)&result_tmp->buffer_offset,
@@ -412,7 +414,7 @@ static void bmi_recv_callback_fn(void *u
 	    NULL,
 	    &q_item->trove_callback,
 	    global_trove_context,
-	    &q_item->posted_id);
+	    &result_tmp->posted_id);
 	result_tmp = result_tmp->next;
 
 	if(ret < 0)
@@ -579,6 +581,7 @@ static void trove_read_callback_fn(void 
 	if(old_result_tmp != &q_item->result_chain)
 	    free(old_result_tmp);
     }while(result_tmp);
+    q_item->result_chain.next = NULL;
     q_item->result_chain_count = 0;
 
     /* while we hold dest lock, look for next seq no. to send */
@@ -783,6 +786,7 @@ static int bmi_send_callback_fn(void *us
     do{
 	assert(q_item->buffer_used);
 	assert(result_tmp->result.bytes);
+	q_item->posted_id = 0;
 	ret = trove_bstream_read_list(q_item->parent->src.u.trove.coll_id,
 	    q_item->parent->src.u.trove.handle,
 	    (char**)&result_tmp->buffer_offset,
@@ -796,7 +800,7 @@ static int bmi_send_callback_fn(void *us
 	    NULL,
 	    &q_item->trove_callback,
 	    global_trove_context,
-	    &q_item->posted_id);
+	    &result_tmp->posted_id);
 	result_tmp = result_tmp->next;
 
 	if(ret < 0)
@@ -873,6 +877,7 @@ static void trove_write_callback_fn(void
 	if(old_result_tmp != &q_item->result_chain)
 	    free(old_result_tmp);
     }while(result_tmp);
+    q_item->result_chain.next = NULL;
     q_item->result_chain_count = 0;
 
     /* if this was the last operation, then mark the flow as done */
@@ -1011,6 +1016,8 @@ static void trove_write_callback_fn(void
 static void cleanup_buffers(struct fp_private_data* flow_data)
 {
     int i;
+    struct result_chain_entry* result_tmp;
+    struct result_chain_entry* old_result_tmp;
 
     if(flow_data->parent->src.endpoint_id == BMI_ENDPOINT &&
 	flow_data->parent->dest.endpoint_id == TROVE_ENDPOINT)
@@ -1024,6 +1031,15 @@ static void cleanup_buffers(struct fp_pr
 		    BUFFER_SIZE,
 		    BMI_RECV);
 	    }
+	    result_tmp = &(flow_data->prealloc_array[i].result_chain);
+	    do{
+		old_result_tmp = result_tmp;
+		result_tmp = result_tmp->next;
+		if(old_result_tmp !=
+		    &(flow_data->prealloc_array[i].result_chain))
+		    free(old_result_tmp);
+	    }while(result_tmp);
+	    flow_data->prealloc_array[i].result_chain.next = NULL;
 	}
     }
     else if(flow_data->parent->src.endpoint_id == TROVE_ENDPOINT &&
@@ -1038,6 +1054,15 @@ static void cleanup_buffers(struct fp_pr
 		    BUFFER_SIZE,
 		    BMI_SEND);
 	    }
+	    result_tmp = &(flow_data->prealloc_array[i].result_chain);
+	    do{
+		old_result_tmp = result_tmp;
+		result_tmp = result_tmp->next;
+		if(old_result_tmp !=
+		    &(flow_data->prealloc_array[i].result_chain))
+		    free(old_result_tmp);
+	    }while(result_tmp);
+	    flow_data->prealloc_array[i].result_chain.next = NULL;
 	}
     }
     else if(flow_data->parent->src.endpoint_id == MEM_ENDPOINT &&



More information about the PVFS2-CVS mailing list