Browse Source

When a data request needs to actually perform a data transfer from a source, we
need to increment the reference counter on the source. In case we reuse a data
request that did not imply a read yet, and that we now have to transfer data,
we increment the refcnt while "upgrading" the request.

Cédric Augonnet 16 years ago
parent
commit
5284a61274
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/datawizard/data_request.c

+ 8 - 0
src/datawizard/data_request.c

@@ -119,7 +119,15 @@ data_request_t search_existing_data_request(data_state *state, uint32_t dst_node
 	{
 		/* perhaps we need to "upgrade" the request */
 		if (read)
+		{
+			/* in case the exisiting request did not imply a memory
+			 * transfer yet, we have to increment the refcnt now
+			 * (so that the source remains valid) */
+			if (!r->read)
+				state->per_node[dst_node].refcnt++;
+
 			r->read = 1;
+		}
 
 		if (write)
 			r->write = 1;