qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/4] qemu-nbd: do not start the block layer in t


From: Kevin Wolf
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0

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 via email to

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