Message ID | 20180906174447.5467-1-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] daemon-unix: Use same name for original or restarted children. | expand |
On Thu, 6 Sep 2018 at 10:45, Ben Pfaff <blp@ovn.org> wrote: > Linux has an idea of process name that is visible in /proc/$pid/comm. This > is "ovs-vswitchd" for a freshly started ovs-vswitchd process. When the > monitor code restarted a crash child, it changed it to the empty string. > This confused the daemon_is_running check in ovs-lib.in, which checks > comm. This commit fixes the problem by setting the program name as comm > in newly restarted children. > > VMware-BZ: #2191724 > Signed-off-by: Ben Pfaff <blp@ovn.org> > Tested it. Looks right Acked-by: Gurucharan Shetty <guru@ovn.org> (But I do see a bunch of unit test failures in branch-2.9 which is unrelated to this fix.) > --- > lib/daemon-unix.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c > index 3ad1c62889cf..6169763c294c 100644 > --- a/lib/daemon-unix.c > +++ b/lib/daemon-unix.c > @@ -428,7 +428,7 @@ monitor_daemon(pid_t daemon_pid) > > /* Running in new daemon process. */ > ovs_cmdl_proctitle_restore(); > - set_subprogram_name(""); > + set_subprogram_name(program_name); > } > > /* If daemonization is configured, then starts daemonization, by forking > and > -- > 2.16.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
On Thu, Sep 06, 2018 at 10:53:29AM -0700, Guru Shetty wrote: > On Thu, 6 Sep 2018 at 10:45, Ben Pfaff <blp@ovn.org> wrote: > > > Linux has an idea of process name that is visible in /proc/$pid/comm. This > > is "ovs-vswitchd" for a freshly started ovs-vswitchd process. When the > > monitor code restarted a crash child, it changed it to the empty string. > > This confused the daemon_is_running check in ovs-lib.in, which checks > > comm. This commit fixes the problem by setting the program name as comm > > in newly restarted children. > > > > VMware-BZ: #2191724 > > Signed-off-by: Ben Pfaff <blp@ovn.org> > > > > Tested it. Looks right > Acked-by: Gurucharan Shetty <guru@ovn.org> Thanks. I applied this to master and backported as far as branch-2.4. > (But I do see a bunch of unit test failures in branch-2.9 which is > unrelated to this fix.) I guess we should handle those separately.
diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c index 3ad1c62889cf..6169763c294c 100644 --- a/lib/daemon-unix.c +++ b/lib/daemon-unix.c @@ -428,7 +428,7 @@ monitor_daemon(pid_t daemon_pid) /* Running in new daemon process. */ ovs_cmdl_proctitle_restore(); - set_subprogram_name(""); + set_subprogram_name(program_name); } /* If daemonization is configured, then starts daemonization, by forking and
Linux has an idea of process name that is visible in /proc/$pid/comm. This is "ovs-vswitchd" for a freshly started ovs-vswitchd process. When the monitor code restarted a crash child, it changed it to the empty string. This confused the daemon_is_running check in ovs-lib.in, which checks comm. This commit fixes the problem by setting the program name as comm in newly restarted children. VMware-BZ: #2191724 Signed-off-by: Ben Pfaff <blp@ovn.org> --- lib/daemon-unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)