qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Pierre Riteau <Pierre.Riteau@irisa.fr>
Subject: Re: [Qemu-devel] [PATCH 4/4] qemu-nbd: do not start the block layer in the parent
Date: Fri, 04 Nov 2011 12:22:26 +0100	[thread overview]
Message-ID: <4EB3CAF2.30703@redhat.com> (raw)
In-Reply-To: <4EB3C826.9030005@redhat.com>

Am 04.11.2011 12:10, schrieb Paolo Bonzini:
> On 11/04/2011 11:31 AM, Kevin Wolf wrote:
>>>  I tried implementing this, but in general daemonization (which forks and
>>>  leave only the children) breaks the threading.
>>>
>>>  So we could either keep this series (which moves all errors to syslog,
>>>  but doesn't otherwise change behavior), or I can finish and post an
>>>  alternative series that removes all forking from qemu-nbd*but*  changes
>>>  behavior in that "qemu-nbd -c" will not daemonize anymore.
>>>
>>>  Since this is 1.0 after all, I'm slightly more inclined towards the latter.
>>>
>>>  Opinions?  Kevin, Anthony?
>>
>> I'm surprised that -c is what causes trouble. As far as I understand,
>> the code for implementing -c doesn't use the qemu block layer at all.
> 
> -c causes qemu-nbd to fork (both to run the server in a child process, 
> and to daemonize).  The server runs in a child process, but that means 
> that the server process loses the aio threads when the parent forks.
> 
>> So why can't we just change the code to fork before it initialises the
>> block layer and opens the image file?
> 
> That's exactly what this series did.  However, daemonization has also to 
> be done before opening the image file.  So the series has to support 
> reporting errors to syslog, and also qemu-nbd will not give a nonzero 
> exit status when errors occur.

The parent could wait until the initialisation is done. As long as it
runs, writing to stderr should just work, no? Or if that doesn't work,
the child could use a pipe to communicate any errors to the parent in
the startup phase and only after the initialisation has completed it
would switch to using syslog.

> Exchanging the server and client roles is also possible (i.e. put the 
> server in the parent process and the client in the child).  It fixes the 
> problem that the thread pool is lost in the server process.  However it 
> still requires daemonization to occur before opening the image file so 
> that errors cannot be reported properly.

Yes, this doesn't solve the problem.

Kevin

  reply	other threads:[~2011-11-04 11:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 10:17 [Qemu-devel] [PATCH 0/4] fix qemu-nbd -c Paolo Bonzini
2011-10-28 10:17 ` [Qemu-devel] [PATCH 1/4] qemu-nbd: exit if the child exits before a socket connection is established Paolo Bonzini
2011-10-28 10:17 ` [Qemu-devel] [PATCH 2/4] qemu-nbd: include our own err/errx implementation Paolo Bonzini
2011-10-28 10:17 ` [Qemu-devel] [PATCH 3/4] qemu-nbd: report errors to syslog when daemonized Paolo Bonzini
2011-10-28 10:17 ` [Qemu-devel] [PATCH 4/4] qemu-nbd: do not start the block layer in the parent Paolo Bonzini
2011-10-28 11:56   ` Pierre Riteau
2011-10-28 11:57     ` Paolo Bonzini
2011-10-28 12:16       ` Pierre Riteau
2011-10-28 12:17         ` Paolo Bonzini
2011-11-04  9:46           ` Paolo Bonzini
2011-11-04 10:31             ` Kevin Wolf
2011-11-04 11:10               ` Paolo Bonzini
2011-11-04 11:22                 ` Kevin Wolf [this message]
2011-11-04 11:25                   ` Paolo Bonzini

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=4EB3CAF2.30703@redhat.com \
    --to=kwolf@redhat.com \
    --cc=Pierre.Riteau@irisa.fr \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).