All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] Stop VM on ENOSPC error.
Date: Wed, 21 Jan 2009 19:00:30 +0200	[thread overview]
Message-ID: <20090121170030.GA16094@redhat.com> (raw)
In-Reply-To: <18807.20276.763061.774652@mariner.uk.xensource.com>

On Wed, Jan 21, 2009 at 04:37:08PM +0000, Ian Jackson wrote:
> > Before? How should we know before specific format write if there is
> > enough space?  And block.c is called by different file formats too. So
> > what do you suggest to do inside bdrv_write() function when write failed?
> 
> I meant `before' in the calling stack sense rather than a temporal
> sense.  `Above' if you prefer.
> 
> bdrv_[p]write would simply fail - as indeed they do in your patch.
> 
> But ide.c doesn't call bdrv_pwrite; it calls bdrv_aio_write.
> bdrv_aio_write would do what your ide.c code currently does.
> 
ide.c calls bdrv_write.

> > > So the formats would still write synchronously, and would pass errors
> > > up to their parent formats, until it reenters the generic block code
> > > where the retry would take place.  At that point the call from the
> > > device emulation would necessariy be asynchronous.
> > 
> > It may reenter block formats many times during one write from ide.
> > Look at block-qcow2.c and calls to bdrv_pwrite() there. 
> 
> Yes.  All of those calls would be allowed to fail with ENOSPC, just as
> in your patch all of the block layer is untouched ane ENOSPC is
> propagated upwards.
> 
> I'm suggesting that instead of catching it in ide.c we should catch it
> in bdrv_aio_write.  bdrv_aio_write can request a VM stop and then
> return to its caller.  Well, actually, we'd have to insert a wrapper
> around the BlockDriverCompletionFunc so that drv->bdrv_aio_write
> doesn't return to the caller directly; instead, it would thread
> through a new function (`bdrv_aio_write_cb' perhaps).
> 
> bdrv_aio_write_cb would check for errors which would stop the VM, and
> in those cases it would request a VM stop and put the request on a
> queue (maintained in block.c) for retry on restart.
> 
And synchronous calls will behave differently. I am all for doing it in
one place, but I am against doing it just for part of API calls. So do
you have better solution for sync calls except don't use them?

And BTW block.c is compiled also for qemu-{img|mbd} no vmstop there.

--
			Gleb.

  reply	other threads:[~2009-01-21 17:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 10:56 [Qemu-devel] [PATCH v4] Stop VM on ENOSPC error Gleb Natapov
2009-01-20 14:01 ` Ian Jackson
2009-01-20 14:16   ` Gleb Natapov
2009-01-20 14:57     ` Ian Jackson
2009-01-20 15:31       ` Gleb Natapov
2009-01-20 16:50         ` Ian Jackson
2009-01-20 18:19           ` Jamie Lokier
2009-01-20 18:23           ` Gleb Natapov
2009-01-21 16:37             ` Ian Jackson
2009-01-21 17:00               ` Gleb Natapov [this message]
2009-01-21 17:25                 ` Ian Jackson
2009-01-21 18:01                   ` Gleb Natapov
2009-01-22 12:39                     ` Ian Jackson
2009-01-21 19:00 ` Anthony Liguori

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=20090121170030.GA16094@redhat.com \
    --to=gleb@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.