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

[Xen-changelog] [qemu-xen master] vl.c: move pidfile creation up the line



commit 004c8e0090025b4fde4e99fbc5a81049be8f79d1
Author:     Michael Tokarev <mjt@xxxxxxxxxx>
AuthorDate: Wed Nov 2 17:18:50 2016 +0300
Commit:     Paolo Bonzini <pbonzini@xxxxxxxxxx>
CommitDate: Wed Nov 9 14:08:17 2016 +0100

    vl.c: move pidfile creation up the line
    
    With current code, pid file is open after various
    sockets, chardevs, fsdevs and the like.  This causes
    interesting effects, for example when monitor is a
    unix-socket, and another qemu instance is already
    running, new qemu first "damages" the socket and
    next complain that it can't acquire the pid file and
    exits, making running qemu unreachable.
    
    Move pid file creation earlier, right after the call
    to os_daemonize(), where we know our process id (pid).
    
    Signed-off-by: Michael Tokarev <mjt@xxxxxxxxxx>
    Message-Id: <1478096330-18081-1-git-send-email-mjt@xxxxxxxxxxxxxxxx>
    Reviewed-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
    Reviewed-by: Markus Armbruster <armbru@xxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 vl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/vl.c b/vl.c
index 319f641..d77dd86 100644
--- a/vl.c
+++ b/vl.c
@@ -4063,6 +4063,11 @@ int main(int argc, char **argv, char **envp)
 
     os_daemonize();
 
+    if (pid_file && qemu_create_pidfile(pid_file) != 0) {
+        error_report("could not acquire pid file: %s", strerror(errno));
+        exit(1);
+    }
+
     if (qemu_init_main_loop(&main_loop_err)) {
         error_report_err(main_loop_err);
         exit(1);
@@ -4340,11 +4345,6 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 
-    if (pid_file && qemu_create_pidfile(pid_file) != 0) {
-        error_report("could not acquire pid file: %s", strerror(errno));
-        exit(1);
-    }
-
     if (qemu_opts_foreach(qemu_find_opts("device"),
                           device_help_func, NULL, NULL)) {
         exit(0);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.