summaryrefslogtreecommitdiff
path: root/lib/dbwrap/dbwrap_tdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dbwrap/dbwrap_tdb.c')
-rw-r--r--lib/dbwrap/dbwrap_tdb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c
index fb6841bcb6..99ea62a3a1 100644
--- a/lib/dbwrap/dbwrap_tdb.c
+++ b/lib/dbwrap/dbwrap_tdb.c
@@ -158,6 +158,21 @@ static struct db_record *db_tdb_fetch_locked(
return db_tdb_fetch_locked_internal(db, mem_ctx, key);
}
+static struct db_record *db_tdb_fetch_locked_timeout(
+ struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key,
+ unsigned int timeout)
+{
+ struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
+ struct db_tdb_ctx);
+
+ db_tdb_log_key("Locking with timeout ", key);
+ if (tdb_chainlock_with_timeout(ctx->wtdb->tdb, key, timeout) != 0) {
+ DEBUG(3, ("tdb_chainlock_with_timeout failed\n"));
+ return NULL;
+ }
+ return db_tdb_fetch_locked_internal(db, mem_ctx, key);
+}
+
static struct db_record *db_tdb_try_fetch_locked(
struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key)
{
@@ -429,6 +444,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
db_tdb->id.ino = st.st_ino;
result->fetch_locked = db_tdb_fetch_locked;
+ result->fetch_locked_timeout = db_tdb_fetch_locked_timeout;
result->try_fetch_locked = db_tdb_try_fetch_locked;
result->traverse = db_tdb_traverse;
result->traverse_read = db_tdb_traverse_read;