From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwwHy-0007cj-FI for qemu-devel@nongnu.org; Mon, 13 Feb 2012 08:50:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwwHs-0002K0-G2 for qemu-devel@nongnu.org; Mon, 13 Feb 2012 08:49:54 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:47559) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwwHr-0002JU-5e for qemu-devel@nongnu.org; Mon, 13 Feb 2012 08:49:48 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2012 13:46:00 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1DDiOGV3506374 for ; Tue, 14 Feb 2012 00:44:25 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1DDnWhB010982 for ; Tue, 14 Feb 2012 00:49:33 +1100 Message-ID: <4F3914E7.30507@linux.vnet.ibm.com> Date: Mon, 13 Feb 2012 19:19:27 +0530 From: Supriya Kannery MIME-Version: 1.0 References: <20120201030557.2990.74150.sendpatchset@skannery.in.ibm.com> <20120201030658.2990.15176.sendpatchset@skannery.in.ibm.com> <4F328FB8.7080403@redhat.com> In-Reply-To: <4F328FB8.7080403@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC Patch 4/7]Qemu: Framework for reopening image files safely Reply-To: supriyak@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Stefan Hajnoczi , Luiz Capitulino , Christoph Hellwig , qemu-devel@nongnu.org On 02/08/2012 08:37 PM, Kevin Wolf wrote: > Am 01.02.2012 04:06, schrieb Supriya Kannery: >> Struct BDRVReopenState along with three reopen related functions >> introduced for handling reopening of images safely. This can be >> extended by each of the block drivers to reopen respective >> image files. >> + } else { >> + open_flags = bs->open_flags; >> + bdrv_close(bs); >> + >> + ret = bdrv_open(bs, bs->filename, bdrv_flags, drv); >> if (ret< 0) { >> - /* Reopen failed with orig and modified flags */ >> - abort(); >> + /* Reopen failed. Try to open with original flags */ >> + qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename); >> + ret = bdrv_open(bs, bs->filename, open_flags, drv); >> + if (ret< 0) { >> + /* Reopen failed with orig and modified flags */ >> + bs->drv = NULL; >> + } >> } > > Most image formats don't have a bdrv_reopen_* implementation after this > series, so usually you'll have something like qcow2 on top of file. This > code uses bdrv_close/open for the whole stack, even though the file > layer could actually make use of a bdrv_reopen_* implementation and the > qcow2 open isn't likely to fail if the image file could be opened. > > I think we can use drv->bdrv_close/open to reopen only one layer and try > using bdrv_reopen_* for the lower layer again. > > This is an improvement that can be done in a separate patch, though. What I understood is, in the enhancement patch, we will have something like (taking qcow2 as an example) Implement bdrv_reopen_qcow2(image file) which reopens only the qcow2 image file Then, drv->bdrv_open(qcow2 driver) will reopen qcow2 driver => calls bdrv_reopen_qcow2(qcow2 image file) if image file has to be reopen Can you please explain a bit more, it this is not what you meant. -thanks, Supriya