On Mon, Oct 07, 2019 at 02:48:40PM -0500, Eric Blake wrote: > One benefit of --pid-file is that it is easier to probe the file > system to see if a pid file has been created than it is to probe if a > socket is available for connection. Document that this is an > intentional feature.
I'm not seeing how checking the pid file is better than checking the socket directly ? I think it is probably actually worse. The main problem with the socket is that while we unlink on clean shutdown, it may still exist in disk if the process has exitted abnormally. With the pidfile though we don't ever unlink it, even on clean shutdown, as we don't use the pid files existance as a mutual exclusion check. We instead acquire fcntl locks on it. IOW the pidfile could exist already when qemu-nbd starts up and will still exist when it quits. > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > qemu-nbd.texi | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/qemu-nbd.texi b/qemu-nbd.texi > index 7f55657722bd..d495bbe8a0ed 100644 > --- a/qemu-nbd.texi > +++ b/qemu-nbd.texi > @@ -118,7 +118,8 @@ in list mode. > @item --fork > Fork off the server process and exit the parent once the server is running. > @item --pid-file=PATH > -Store the server's process ID in the given file. > +Store the server's process ID in the given file. The pid file is not > +created until after the server socket is open. > @item --tls-authz=ID > Specify the ID of a qauthz object previously created with the > --object option. This will be used to authorize connecting users > -- > 2.21.0 > > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|