From 8e070294542a23e55e9305deaa52a3df30649122 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 Mar 2019 08:50:53 -0600 Subject: [PATCH] mds,mgr,mon: warn future respawn() copy-pasters to set thread name Signed-off-by: Sage Weil --- src/mds/MDSDaemon.cc | 8 ++++++++ src/mgr/MgrStandby.cc | 8 ++++++++ src/mon/Monitor.cc | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index c1bbeb82077..9b22a1a92a7 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -1073,6 +1073,14 @@ void MDSDaemon::suicide() void MDSDaemon::respawn() { + // --- WARNING TO FUTURE COPY/PASTERS --- + // You must also add a call like + // + // ceph_pthread_setname(pthread_self(), "ceph-mds"); + // + // to main() so that /proc/$pid/stat field 2 contains "(ceph-mds)" + // instead of "(exe)", so that killall (and log rotation) will work. + dout(1) << "respawn!" << dendl; /* Dump recent in case the MDS was stuck doing something which caused it to diff --git a/src/mgr/MgrStandby.cc b/src/mgr/MgrStandby.cc index e0c80e0b00e..061ddd0f9b9 100644 --- a/src/mgr/MgrStandby.cc +++ b/src/mgr/MgrStandby.cc @@ -302,6 +302,14 @@ void MgrStandby::shutdown() void MgrStandby::respawn() { + // --- WARNING TO FUTURE COPY/PASTERS --- + // You must also add a call like + // + // ceph_pthread_setname(pthread_self(), "ceph-mgr"); + // + // to main() so that /proc/$pid/stat field 2 contains "(ceph-mgr)" + // instead of "(exe)", so that killall (and log rotation) will work. + char *new_argv[orig_argc+1]; dout(1) << " e: '" << orig_argv[0] << "'" << dendl; for (int i=0; i