From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZNan-0001d1-22 for qemu-devel@nongnu.org; Wed, 01 Oct 2014 13:21:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZNag-0000S1-RW for qemu-devel@nongnu.org; Wed, 01 Oct 2014 13:21:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZNag-0000Rt-HZ for qemu-devel@nongnu.org; Wed, 01 Oct 2014 13:21:26 -0400 Message-ID: <542C380F.3010709@redhat.com> Date: Wed, 01 Oct 2014 19:21:19 +0200 From: Max Reitz MIME-Version: 1.0 References: <1412105144-532-1-git-send-email-armbru@redhat.com> <1412105144-532-20-git-send-email-armbru@redhat.com> In-Reply-To: <1412105144-532-20-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 19/23] blockdev: Fix blockdev-add not to create DriveInfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, benoit.canet@nodalink.com, stefanha@redhat.com On 30.09.2014 21:25, Markus Armbruster wrote: > blockdev_init() always creates a DriveInfo, but only drive_new() fills > it in. qmp_blockdev_add() leaves it blank. This results in a drive > with type = IF_IDE, bus = 0, unit = 0. Screwed up in commit ee13ed1c. > > Board initialization code looking for IDE drive (0,0) can pick up one > of these bogus drives. The QMP command has to execute really early to > be visible. Not sure how likely that is in practice. > > Fix by creating DriveInfo in drive_new(). Block backends created by > blockdev-add don't get one. > > Breaks the test for "has been created by qmp_blockdev_add()" in > blockdev_mark_auto_del() and do_drive_del(), because it changes the > value of dinfo && !dinfo->enable_auto_del from true to false. Simply > test !dinfo instead. > > Leaves DriveInfo member enable_auto_del unused. Drop it. > > A few places assume a block backend always has a DriveInfo. Fix them > up. > > Signed-off-by: Markus Armbruster > --- > block/block-backend.c | 2 +- > blockdev.c | 22 +++++++--------------- > hw/block/block.c | 16 ++++++++++------ > hw/ide/qdev.c | 2 +- > hw/scsi/scsi-disk.c | 2 +- > include/sysemu/blockdev.h | 1 - > 6 files changed, 20 insertions(+), 25 deletions(-) Reviewed-by: Max Reitz