From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULAT9-0000eU-1S for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULAT5-0006p6-LW for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:54:06 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:53312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULAT5-0006ot-Et for qemu-devel@nongnu.org; Thu, 28 Mar 2013 06:54:03 -0400 Received: by mail-we0-f181.google.com with SMTP id d7so2660539wer.12 for ; Thu, 28 Mar 2013 03:54:02 -0700 (PDT) Date: Thu, 28 Mar 2013 11:53:57 +0100 From: Stefan Hajnoczi Message-ID: <20130328105357.GB15114@stefanha-thinkpad.redhat.com> References: <1364401698-21402-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1364401698-21402-1-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: Fix direct use of protocols as driver for bdrv_open() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pl@dlhnet.de, qemu-devel@nongnu.org, stefanha@redhat.com On Wed, Mar 27, 2013 at 05:28:18PM +0100, Kevin Wolf wrote: > bdrv_open_common() implements direct use of protocols by copying the > pre-opened BlockDriverStates to bs using bdrv_swap(). It did however > first set some fields in bs, which end up in file after the swap. When > bdrv_open() destroys file, it appears to be open, and because it isn't, > qemu could segfault while trying to close it. > > Reorder the operations to return immediately in such cases so that file > is correctly detected as closed. > > Signed-off-by: Kevin Wolf > --- > block.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) Didn't apply cleanly, please check that I resolved the conflict correctly. Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan