From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brWgU-00024t-C4 for qemu-devel@nongnu.org; Tue, 04 Oct 2016 16:51:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brWgQ-0004ez-6T for qemu-devel@nongnu.org; Tue, 04 Oct 2016 16:51:30 -0400 Received: from mail-db5eur01on0133.outbound.protection.outlook.com ([104.47.2.133]:49172 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brWgP-0004eX-Ii for qemu-devel@nongnu.org; Tue, 04 Oct 2016 16:51:26 -0400 References: <1475578981-24126-1-git-send-email-den@openvz.org> <20161004110944.GF5578@redhat.com> From: "Denis V. Lunev" Message-ID: Date: Tue, 4 Oct 2016 14:15:16 +0300 MIME-Version: 1.0 In-Reply-To: <20161004110944.GF5578@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 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: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, Denis Plotnikov , Paolo Bonzini On 10/04/2016 02:09 PM, Daniel P. Berrange wrote: > On Tue, Oct 04, 2016 at 02:03:01PM +0300, Denis V. Lunev wrote: >> From: Denis Plotnikov >> >> The NBD server socket was created by qemu-nbd code. This could lead to the >> race issue when the management layer started qemu-nbd server and allowed >> a client to connect to the server, the client tried to connect to the >> server but failed because qemu-nbd had not managed to open the listening >> server socket by the time the client has finished its trying to connect. >> >> Creating a listening socket before starting of qemu-ndb and passing the >> socket fd to be used as the server socket to qemu-nbd as an option solves >> this issue. >> >> It also helps to resolve the situation when qemu-nbd started by some >> management software should report the port number qemu-nbd bound to, to >> another piece of software. Right now, there is no good way to do that >> except to start the qemu-nbd to make sure that the certain port has been >> actually aquired. Otherwise, it is definitely racy to try to define the >> port first and then start the qemu-nbd, hoping that the port defined is >> still available. Passing of the pre-created file descriptor resolves this >> situation as well. >> >> As a plus, pre-creating of the server socket adds some degree of freedom in >> setting of the socket properties. It is so, because once qemu-nbd gets >> the socket fd, it starts using it as is, without any additional >> modifications. >> >> Signed-off-by: Denis Plotnikov >> Reviewed-by: Roman Kagan >> Signed-off-by: Denis V. Lunev >> CC: Paolo Bonzini >> --- >> qemu-nbd.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- >> qemu-nbd.texi | 6 ++++ >> 2 files changed, 89 insertions(+), 12 deletions(-) >> >> Changes from v1: >> - commit message improvements >> - Eric's style nits applied > It seems you've ignored the suggestion to implement the systemd socket > activation protocol, which would avoid the need for any new command > line parameters, and would let qemu-nbd "just work" with systemd units > too. > > > Regards, > Daniel thank you very much. I have missed that letter. Pls disregard this sending. ya, we will start over ;) Den