From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rui7F-0002lv-74 for qemu-devel@nongnu.org; Tue, 07 Feb 2012 05:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rui79-0000Jq-7f for qemu-devel@nongnu.org; Tue, 07 Feb 2012 05:17:37 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:54244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rui79-0000Jl-1q for qemu-devel@nongnu.org; Tue, 07 Feb 2012 05:17:31 -0500 Received: by wibhi20 with SMTP id hi20so5614112wib.4 for ; Tue, 07 Feb 2012 02:17:30 -0800 (PST) Date: Tue, 7 Feb 2012 10:17:27 +0000 From: Stefan Hajnoczi Message-ID: <20120207101727.GC29427@stefanha-thinkpad.localdomain> References: <20120201030557.2990.74150.sendpatchset@skannery.in.ibm.com> <20120201030712.2990.41527.sendpatchset@skannery.in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120201030712.2990.41527.sendpatchset@skannery.in.ibm.com> Subject: Re: [Qemu-devel] [RFC Patch 5/7]Qemu: raw-posix image file reopen List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Supriya Kannery Cc: Kevin Wolf , Christoph Hellwig , qemu-devel@nongnu.org, Luiz Capitulino 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