From: "Charles Coffing" Subject: [PATCH] hang in qcow2raw Date: Fri, 30 Mar 2007 15:37:41 -0400 Message-ID: <460D11D4.D169.003C.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part51761715.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__Part51761715.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. Signed-off-by: Charles Coffing --=__Part51761715.0__= Content-Type: text/plain; name="qcow2raw-hang.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="qcow2raw-hang.patch" --- a/tools/blktap/drivers/qcow2raw.c 2007-03-12 09:01:04.000000000 = -0600 +++ b/tools/blktap/drivers/qcow2raw.c 2007-03-30 13:07:57.000000000 = -0600 @@ -51,7 +51,6 @@ #define BLOCK_PROCESSSZ 4096 =20 static int maxfds, *qcowio_fd, *aio_fd, running =3D 1, complete =3D 0;=20 -static int read_complete =3D 0, write_complete =3D 0; static int returned_read_events =3D 0, returned_write_events =3D 0; static int submit_events =3D 0; static uint32_t read_idx =3D 0, write_idx =3D 0; @@ -109,8 +108,6 @@ written +=3D BLOCK_PROCESSSZ; returned_write_events++; write_idx =3D idx; - if (complete && (returned_write_events =3D=3D submit_events))=20 - write_complete =3D 1; =20 debug_output(written, dd->td_state->size << 9); free(private); @@ -126,8 +123,6 @@ =09 returned_read_events++; read_idx =3D idx; - if (complete && (returned_read_events =3D=3D submit_events))=20 - read_complete =3D 1; =09 ret =3D ddaio.drv->td_queue_write(&ddaio, idx, BLOCK_PROCESSSZ>>9, = private,=20 send_write_responses, idx, = private); @@ -136,7 +131,7 @@ return 0; } =20 - if ( (complete && returned_read_events =3D=3D submit_events) ||=20 + if ( (returned_read_events =3D=3D submit_events) ||=20 (returned_read_events % 10 =3D=3D 0) ) { ddaio.drv->td_submit(&ddaio); } @@ -299,6 +294,7 @@ } =09 /*Attempt to read 4k sized blocks*/ + submit_events++; ret =3D ddqcow.drv->td_queue_read(&ddqcow, i>>9, BLOCK_PROCESSSZ>>9,= buf,=20 send_read_responses= , i>>9, buf); @@ -309,7 +305,6 @@ exit(-1); } else { i +=3D BLOCK_PROCESSSZ; - submit_events++; } =20 if (i >=3D ddqcow.td_state->size<<9) { --=__Part51761715.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part51761715.0__=--