]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: set ceph-mds name uncond for external tools 14673/head
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 17 Mar 2017 01:45:46 +0000 (21:45 -0400)
committerNathan Cutler <ncutler@suse.com>
Mon, 19 Jun 2017 21:38:36 +0000 (23:38 +0200)
External tools like logrotate which use killall rely on the "ceph-mds" name to
find it in /proc/*/comm. This is normally the case but when ceph-mds respawns
using /proc/self/exe (on Linux), its name will change to "exe". This makes
logrotate fail to signal ceph-mds the log needs to be reopened and will lead to
the log growing until the disk is full.

This patch unconditionally sets the name so on respawn the name is correct (and
in any other possible scenario, such as a misnamed executable).  Note, there is
still a very small race between execve and ceph_pthread_setname where the
process name is wrong.

Problem was introduced by 66a122025f6cf023cf7b2f3d8fbe4964fb7568a7.

Fixes: http://tracker.ceph.com/issues/19291
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 4f177bb6b72cf9c8eb363051b27496c026b345f0)

Conflicts:
    src/ceph_mds.cc - use pthread_setname_np() instead of
        ceph_pthread_setname(), drop compat.h include

src/ceph_mds.cc

index 40ac730a3b72c38a3ca468e7e561e11d619e62d8..43a025263f4f773b6ddfd281ea315ec2a6dad1d6 100644 (file)
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <pthread.h>
 
 #include <iostream>
 #include <string>
@@ -89,6 +90,8 @@ static void handle_mds_signal(int signum)
 
 int main(int argc, const char **argv) 
 {
+  pthread_setname_np(pthread_self(), "ceph-mds");
+
   vector<const char*> args;
   argv_to_vec(argc, argv, args);
   env_to_vec(args);