[ovs-dev] [PATCH 04/13] log: Log write errors.
Ben Pfaff
blp at ovn.org
Fri Dec 8 00:12:31 UTC 2017
This saves all the callers from logging them separately.
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ovsdb/log.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ovsdb/log.c b/ovsdb/log.c
index 1a372d7b73ee..f3c6e22ae212 100644
--- a/ovsdb/log.c
+++ b/ovsdb/log.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "openvswitch/json.h"
+#include "openvswitch/vlog.h"
#include "lockfile.h"
#include "ovsdb.h"
#include "ovsdb-error.h"
@@ -33,6 +34,8 @@
#include "transaction.h"
#include "util.h"
+VLOG_DEFINE_THIS_MODULE(ovsdb_log);
+
enum ovsdb_log_mode {
OVSDB_LOG_READ,
OVSDB_LOG_WRITE
@@ -411,6 +414,10 @@ ovsdb_log_write(struct ovsdb_log *file, const struct json *json)
{
error = ovsdb_io_error(errno, "%s: write failed", file->name);
+ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
+ VLOG_WARN_RL(&rl, "%s: write failed (%s)",
+ file->name, ovs_strerror(errno));
+
/* Remove any partially written data, ignoring errors since there is
* nothing further we can do. */
ignore(ftruncate(fileno(file->stream), file->offset));
--
2.10.2
More information about the dev
mailing list