From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxIYz-0000Zi-TL for qemu-devel@nongnu.org; Tue, 14 Feb 2012 08:37:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxIYp-0001T9-HN for qemu-devel@nongnu.org; Tue, 14 Feb 2012 08:36:57 -0500 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:42961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxIYo-0001St-To for qemu-devel@nongnu.org; Tue, 14 Feb 2012 08:36:47 -0500 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Feb 2012 19:06:41 +0530 Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1EDab1n4718828 for ; Tue, 14 Feb 2012 19:06:37 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1EDaanj004944 for ; Wed, 15 Feb 2012 00:36:37 +1100 Message-ID: <4F3A6364.7000803@linux.vnet.ibm.com> Date: Tue, 14 Feb 2012 19:06:36 +0530 From: Supriya Kannery MIME-Version: 1.0 References: <20120201030557.2990.74150.sendpatchset@skannery.in.ibm.com> <20120201030712.2990.41527.sendpatchset@skannery.in.ibm.com> <20120207101727.GC29427@stefanha-thinkpad.localdomain> In-Reply-To: <20120207101727.GC29427@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC Patch 5/7]Qemu: raw-posix image file reopen Reply-To: supriyak@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Christoph Hellwig , qemu-devel@nongnu.org, Luiz Capitulino On 02/07/2012 03:47 PM, Stefan Hajnoczi wrote: > On Wed, Feb 01, 2012 at 08:37:12AM +0530, Supriya Kannery wrote: >> + /* stash state before reopen */ >> + raw_rs->stash_s = g_malloc0(sizeof(BDRVRawState)); >> + memcpy(raw_rs->stash_s, s, sizeof(BDRVRawState)); > > Copying a struct is fragile, Mike Roth pointed out the potential issue > with aligned_buf. > > If raw-posix could open from a given file descriptor as an alternative > to opening a filename, then it would be clean and natural to simply > re-initialize from the dup'd file descriptor in the abort case. That's > the approach I would try instead of stashing the whole struct. > > Stefan > fine, will get V1 with stashing of only required fields wherever possible instead of stashing the full struct.