From: Zhi Zhang Date: Mon, 1 Feb 2016 03:03:30 +0000 (+0800) Subject: [ceph-fuse] fix ceph-fuse writing to stale log file after log rotation X-Git-Tag: v0.94.7~45^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7110%2Fhead;p=ceph.git [ceph-fuse] fix ceph-fuse writing to stale log file after log rotation This fix should be applied to hammer branch. It can't be directly applied to master branch, because logrotate.conf is changed on matser since ceph-osd, ceph-mon, etc, is controlled by systemd with user/group as 'ceph' by default, while ceph-fuse might be started as root privilege by external users. Signed-off-by: Zhi Zhang --- diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index 4d46639be86..84d4128bd9a 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -31,6 +31,7 @@ using namespace std; #include "common/Timer.h" #include "common/ceph_argparse.h" #include "global/global_init.h" +#include "global/signal_handler.h" #include "common/safe_io.h" #ifndef DARWIN @@ -211,6 +212,9 @@ int main(int argc, const char **argv, const char *envp[]) { goto out_client_unmount; } + init_async_signal_handler(); + register_async_signal_handler(SIGHUP, sighup_handler); + cerr << "ceph-fuse[" << getpid() << "]: starting fuse" << std::endl; tester.init(cfuse, client); tester.create(); @@ -249,6 +253,9 @@ int main(int argc, const char **argv, const char *envp[]) { free(newargv); delete mc; + + unregister_async_signal_handler(SIGHUP, sighup_handler); + shutdown_async_signal_handler(); //cout << "child done" << std::endl; return r; diff --git a/src/logrotate.conf b/src/logrotate.conf index 9ae27baee45..df31e1d7d2b 100644 --- a/src/logrotate.conf +++ b/src/logrotate.conf @@ -23,6 +23,7 @@ done done fi + killall -q -1 ceph-fuse || true endscript missingok notifempty