Whamcloud - gitweb
LU-4129 libcfs: Only dump log once per sec. to avoid EEXIST 64/8964/5
authorRyan Haasken <haasken@cray.com>
Wed, 22 Jan 2014 19:34:15 +0000 (13:34 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 1 Mar 2014 02:36:13 +0000 (02:36 +0000)
commitad17dd9122128fdea668894ace6a47c970126889
tree6df8b6f3dbfaefafb8e2e34e963078bff9056460
parenteff9227f207c667042f515981f87b4e2f5d615f9
LU-4129 libcfs: Only dump log once per sec. to avoid EEXIST

Since the log file name contains the current time in seconds, dumping
the logs more than once per second causes EEXIST errors to be emitted.
Add a static variable to libcfs_debug_dumplog_internal that records
the time of the last Lustre log dump.  If the current time in seconds
is equal to the last time, do not dump logs again.

Note that this is not thread-safe.  However, in the rare case that two
threads try to access last_dump_time simultaneously, the worst thing
that could happen is that one of the threads will get an EEXIST error
when trying to write the log file.  This is no worse than the current
situation, and it is not likely to happen.

Signed-off-by: Ryan Haasken <haasken@cray.com>
Change-Id: I7345635ab84333d6c1b455de6059d9d72e5a88f5
Reviewed-on: http://review.whamcloud.com/8964
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
libcfs/libcfs/debug.c