All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Supriya Kannery <supriyak@linux.vnet.ibm.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel@nongnu.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [Qemu-devel] [V5 Patch 3/4]Qemu: Command "block_set" for dynamic block params change
Date: Thu, 28 Jul 2011 12:23:22 +0200	[thread overview]
Message-ID: <4E31389A.4080609@redhat.com> (raw)
In-Reply-To: <CAJSP0QXNNahA5U35QvjsthLTw6tQN5HZd_Odd=obd9Vj_qba7w@mail.gmail.com>

Am 27.07.2011 16:51, schrieb Stefan Hajnoczi:
> 2011/7/27 Michael Tokarev <mjt@tls.msk.ru>:
>> 27.07.2011 15:30, Supriya Kannery wrote:
>>> New command "block_set" added for dynamically changing any of the block
>>> device parameters. For now, dynamic setting of hostcache params using this
>>> command is implemented. Other block device parameter changes, can be
>>> integrated in similar lines.
>>>
>>> Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
>>>
>>> ---
>>>  block.c         |   54 +++++++++++++++++++++++++++++++++++++++++++++++++
>>>  block.h         |    2 +
>>>  blockdev.c      |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  blockdev.h      |    1
>>>  hmp-commands.hx |   14 ++++++++++++
>>>  qemu-config.c   |   13 +++++++++++
>>>  qemu-option.c   |   25 ++++++++++++++++++++++
>>>  qemu-option.h   |    2 +
>>>  qmp-commands.hx |   28 +++++++++++++++++++++++++
>>>  9 files changed, 200 insertions(+)
>>>
>>> Index: qemu/block.c
>>> ===================================================================
>>> --- qemu.orig/block.c
>>> +++ qemu/block.c
>>> @@ -651,6 +651,34 @@ unlink_and_fail:
>>>      return ret;
>>>  }
>>>
>>> +int bdrv_reopen(BlockDriverState *bs, int bdrv_flags)
>>> +{
>>> +    BlockDriver *drv = bs->drv;
>>> +    int ret = 0, open_flags;
>>> +
>>> +    /* Quiesce IO for the given block device */
>>> +    qemu_aio_flush();
>>> +    if (bdrv_flush(bs)) {
>>> +        qerror_report(QERR_DATA_SYNC_FAILED, bs->device_name);
>>> +        return ret;
>>> +    }
>>> +    open_flags = bs->open_flags;
>>> +    bdrv_close(bs);
>>> +
>>> +    ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
>>> +    if (ret < 0) {
>>> +        /* Reopen failed. Try to open with original flags */
>>> +        qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
>>> +        ret = bdrv_open(bs, bs->filename, open_flags, drv);
>>> +        if (ret < 0) {
>>> +            /* Reopen failed with orig and modified flags */
>>> +            abort();
>>> +        }
>>
>> Can we please avoid this stuff completely?  Just keep the
>> old device open still, until you're sure new one is ok.
>>
>> Or else it will be quite dangerous command in many cases.
>> For example, after -runas/-chroot, or additional selinux
>> settings or whatnot.  And in this case, instead of merely
>> returning an error, we'll see abort().  Boom.
> 
> Slight complication for image formats that use a dirty bit here.  QED
> has a dirty bit.  VMDK also specifies one but we don't implement it
> today.
> 
> If the image file is dirty then all its metadata will be scanned for
> consistency when it is opened.  This increases the bdrv_open() time
> and hence the downtime of the VM.  So it is not ideal to open the
> image file twice, even though there is no consistency problem.

In general I really like understatements, but opening an image file
twice isn't only "not ideal", but should be considered verboten.

We're still doing it during migration and it means that in upstream qemu
any non-raw images will be corrupted.

> I'll think about this some more, there are a couple of solutions like
> keeping only the file descriptor around, introducing a flush command
> that makes sure the file is in a clean state, or changing QED to not
> do this.

Changing the format drivers doesn't really look like the right solution.

Keeping the fd around looks okay, we can probably achieve this by
introducing a bdrv_reopen function. It means that we may need to reopen
the format layer, but it can't really fail.

Kevin

  reply	other threads:[~2011-07-28 10:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 11:30 [Qemu-devel] [V5 Patch 0/4]Qemu: Set host cache from cmdline and monitor Supriya Kannery
2011-07-27 11:30 ` [Qemu-devel] [V5 Patch 1/4]Qemu: Enhance "info block" to display host cache setting Supriya Kannery
2011-07-27 14:19   ` Stefan Hajnoczi
2011-07-28 10:39     ` Supriya Kannery
2011-07-27 11:30 ` [Qemu-devel] [V5 Patch 2/4]Qemu: qerrors for file reopen, data sync and cmd syntax Supriya Kannery
2011-07-27 11:30 ` [Qemu-devel] [V5 Patch 3/4]Qemu: Command "block_set" for dynamic block params change Supriya Kannery
2011-07-27 12:58   ` Anthony Liguori
2011-07-27 14:31     ` Stefan Hajnoczi
2011-07-27 16:02       ` Anthony Liguori
2011-07-28  9:29         ` Stefan Hajnoczi
2011-08-01 15:22           ` Stefan Hajnoczi
2011-08-01 15:28             ` Anthony Liguori
2011-08-01 15:34               ` Stefan Hajnoczi
2011-08-01 15:44               ` Kevin Wolf
2011-08-01 15:44                 ` Anthony Liguori
2011-08-04  8:32                   ` Supriya Kannery
2011-08-04  8:31                     ` Stefan Hajnoczi
2011-08-04  9:33                       ` Supriya Kannery
2011-08-04  9:17                     ` Supriya Kannery
2011-08-01 15:44                 ` Stefan Hajnoczi
2011-08-01 15:46                   ` Anthony Liguori
2011-07-28 10:13         ` Supriya Kannery
2011-07-28 12:48           ` Anthony Liguori
2011-07-27 13:43   ` Michael Tokarev
2011-07-27 13:52     ` Anthony Liguori
2011-07-27 14:51     ` Stefan Hajnoczi
2011-07-28 10:23       ` Kevin Wolf [this message]
2011-07-28 13:10         ` Stefan Hajnoczi
2011-07-28 13:23           ` Kevin Wolf
2011-07-27 11:31 ` [Qemu-devel] [V5 Patch 4/4]Qemu: Add commandline -drive option 'hostcache' Supriya Kannery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E31389A.4080609@redhat.com \
    --to=kwolf@redhat.com \
    --cc=hch@lst.de \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=supriyak@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.