From: Sage Weil Date: Fri, 27 Feb 2009 04:27:56 +0000 (-0800) Subject: debug: ensure a SIGHUP reopens log reasonably soon X-Git-Tag: v0.7~125 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2389c5316c81b0f9690079b9f6f79b42790b191;p=ceph.git debug: ensure a SIGHUP reopens log reasonably soon Since nothing new may be written to the log for a while, check if it needs to be reopened in the mds/osd/mon tick() method. --- diff --git a/src/common/debug.h b/src/common/debug.h index be4c14d38391..f5e5433a6135 100644 --- a/src/common/debug.h +++ b/src/common/debug.h @@ -24,6 +24,12 @@ extern void _dout_open_log(); extern int _dout_rename_output_file(); // after calling daemon() extern int _dout_create_courtesy_output_symlink(const char *type, int n); +static inline void _dout_check_log() { + _dout_lock.Lock(); + if (_dout_need_open) + _dout_open_log(); + _dout_lock.Unlock(); +} static inline void _dout_begin_line() { _dout_lock.Lock(); diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 133742dece6b..75ff5dc115ca 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -384,6 +384,8 @@ void MDS::tick() // reschedule reset_tick(); + _dout_check_log(); + logclient.send_log(); if (laggy) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1cf64c73dd8f..53ed06603c46 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -505,6 +505,8 @@ void Monitor::tick() { tick_timer = 0; + _dout_check_log(); + // ok go. dout(11) << "tick" << dendl; diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 40ffdf3bb928..5e45a97e09a6 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1083,6 +1083,8 @@ void OSD::tick() assert(osd_lock.is_locked()); dout(5) << "tick" << dendl; + _dout_check_log(); + if (got_sigterm) { dout(0) << "got SIGTERM, shutting down" << dendl; messenger->send_message(new MGenericMessage(CEPH_MSG_SHUTDOWN),