Skip to contentSkip to conversation

hang in qcow2raw

PATCH New Charles Coffing 1 participant 1 message Mar 30, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hang in qcow2raw

Hi,

We hit a bug in which qcow2raw would hang the conversion just short of 100%, because the final write queue was never being submitted. If a blktap drivers read synchronously, then "submit_events" and "complete" variables are checked before getting set, so the fact that reads have finished is not noticed, so the final write queue was never submitted.

Note that I have also removed the variables write_complete and read_complete. They were unused, and they were also not set correctly in the synchronous case.

Patch attached; please apply to xen-unstable.

Thanks.

tools/blktap/drivers/qcow2raw.c +2 -7
@@ -51,7 +51,6 @@
 #define BLOCK_PROCESSSZ 4096
 
 static int maxfds, *qcowio_fd, *aio_fd, running = 1, complete = 0; 
-static int read_complete = 0, write_complete = 0;
 static int returned_read_events = 0, returned_write_events = 0;
 static int submit_events = 0;
 static uint32_t read_idx = 0, write_idx = 0;
@@ -109,8 +108,6 @@
 	written += BLOCK_PROCESSSZ;
 	returned_write_events++;
 	write_idx = idx;
-	if (complete && (returned_write_events == submit_events)) 
-		write_complete = 1;
 
 	debug_output(written, dd->td_state->size << 9);
 	free(private);
@@ -126,8 +123,6 @@
 	
 	returned_read_events++;
 	read_idx = idx;
-	if (complete && (returned_read_events == submit_events)) 
-		read_complete = 1;
 	
 	ret = ddaio.drv->td_queue_write(&ddaio, idx, BLOCK_PROCESSSZ>>9, private, 
 					send_write_responses, idx, private);
@@ -136,7 +131,7 @@
 		return 0;
 	}
 
-	if ( (complete && returned_read_events == submit_events) || 
+	if ( (returned_read_events == submit_events) || 
 	     (returned_read_events % 10 == 0) ) {
 		ddaio.drv->td_submit(&ddaio);
 	}
@@ -299,6 +294,7 @@
 			}
 		
 			/*Attempt to read 4k sized blocks*/
+			submit_events++;
 			ret = ddqcow.drv->td_queue_read(&ddqcow, i>>9,
 							BLOCK_PROCESSSZ>>9, buf, 
 							send_read_responses, i>>9, buf);
@@ -309,7 +305,6 @@
 				exit(-1);
 			} else {
 				i += BLOCK_PROCESSSZ;
-				submit_events++;
 			}
 
 			if (i >= ddqcow.td_state->size<<9) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel