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.
This commit is contained in:
Sage Weil 2009-02-26 20:27:56 -08:00
parent 843c598e8b
commit e2389c5316
4 changed files with 12 additions and 0 deletions

View File

@ -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();

View File

@ -384,6 +384,8 @@ void MDS::tick()
// reschedule
reset_tick();
_dout_check_log();
logclient.send_log();
if (laggy)

View File

@ -505,6 +505,8 @@ void Monitor::tick()
{
tick_timer = 0;
_dout_check_log();
// ok go.
dout(11) << "tick" << dendl;

View File

@ -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),