From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpaW7-00052e-Dl for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:32:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpaW1-0003Kw-D1 for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:32:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpaW1-0003Kq-6P for qemu-devel@nongnu.org; Thu, 29 Sep 2016 08:32:41 -0400 Date: Thu, 29 Sep 2016 13:32:35 +0100 From: "Daniel P. Berrange" Message-ID: <20160929123235.GQ5312@redhat.com> Reply-To: "Daniel P. Berrange" References: <1475146935-12118-1-git-send-email-den@openvz.org> <20160929111318.GN5312@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 1/1] qemu-nbd: add the option to use pre-created server socket List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: "Denis V. Lunev" , qemu-devel@nongnu.org, Denis Plotnikov On Thu, Sep 29, 2016 at 02:18:54PM +0200, Paolo Bonzini wrote: > > > On 29/09/2016 13:13, Daniel P. Berrange wrote: > > On Thu, Sep 29, 2016 at 02:02:15PM +0300, Denis V. Lunev wrote: > >> From: Denis Plotnikov > >> > >> Originally NBD server socket was created by qemu-nbd code. This leads to > >> the race when the management layer starts qemu-nbd server and allows a > >> client to connect to the server. In this case there is a possibility that > >> qemu-nbd does not open listening server socket yet. Creating listening > >> socket before starting of qemu-ndb and passing socket fd via command line > >> solves this issue completely. > > > > FWIW, this could be solved in qemu-nbd itself if we had a general > > ability to request "daemon" mode - currently it only daemonizes > > if attaching to a nbd block device. > > > > The key would be that qemu-nbd would open the listening socket > > before daemonizing. Thus when the mgmt application spawned > > qemu-nbd in daemon mode, it can be sure that the listener > > socket is present when waitpid() completes. > > This is 100% true, but I find daemonization to be a hack, so file > descriptor passing has its place. > > Still, I'd prefer to have a --socket-activation option which uses the > systemd socket activation protocol. The systemd protocol can be > implemented easily by any management layer. That's a nice idea - system socket activation is pretty simple todo Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|