]> git.karo-electronics.de Git - linux-beck.git/commit
staging: lustre: libcfs: Only dump log once per sec. to avoid EEXIST
authorRyan Haasken <haasken@cray.com>
Tue, 16 Aug 2016 20:18:32 +0000 (16:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 13:57:34 +0000 (15:57 +0200)
commita9bcd881b27fc8a4e7e3eccf4bb834a9e20a7508
tree67f8eb78067db7610ae130ae87c89f18d02e28a8
parent503df2c4dfcfa32d6e0b03503a31ef76b3144450
staging: lustre: 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>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4129
Reviewed-on: http://review.whamcloud.com/8964
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/debug.c