From 88ce92b92efe12f8a7364eb1786d73ec8ecd7884 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 07:39:13 +0930 Subject: tdb2: suppress tdb1 backend logging when locking returns EINTR or EAGAIN The TDB1 code logs multiple times on errors; we must prevent that in the limited case where locking fails. With TDB2, this can happen due to the lock function attribute, where the user supplies replacement locking functions which are allowed to return with errno EAGAIN or EINTR for various special-effects. Flooding the logs for this is unfriendly. Signed-off-by: Rusty Russell (Imported from CCAN commit a391b2b900bc6d5c0467869a454bdb5c51b5a3be) --- lib/tdb2/tdb1_lock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/tdb2/tdb1_lock.c') diff --git a/lib/tdb2/tdb1_lock.c b/lib/tdb2/tdb1_lock.c index 2252e4791b..6498b71367 100644 --- a/lib/tdb2/tdb1_lock.c +++ b/lib/tdb2/tdb1_lock.c @@ -180,7 +180,8 @@ int tdb1_lock(struct tdb1_context *tdb, int list, int ltype) int ret; ret = tdb1_lock_list(tdb, list, ltype, TDB_LOCK_WAIT); - if (ret) { + /* Don't log for EAGAIN and EINTR: they could have overridden lock fns */ + if (ret && errno != EAGAIN && errno != EINTR) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, "tdb1_lock failed on list %d " "ltype=%d (%s)", list, ltype, strerror(errno)); -- cgit