qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 19/23] blockdev: Fix blockdev-add not to crea


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v4 19/23] blockdev: Fix blockdev-add not to create DriveInfo
Date: Wed, 01 Oct 2014 19:21:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2

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 <address@hidden>
---
  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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]