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 <dplotni...@virtuozzo.com> >> >> 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 <dplotni...@virtuozzo.com> >> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> >> Signed-off-by: Denis V. Lunev <d...@openvz.org> >> CC: Paolo Bonzini <pbonz...@redhat.com> >> --- >> 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