diff options
-rw-r--r-- | ctdb/lib/tdb/common/lock.c | 20 | ||||
-rw-r--r-- | ctdb/lib/tdb/include/tdb.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/ctdb/lib/tdb/common/lock.c b/ctdb/lib/tdb/common/lock.c index 803feeecbb0..f0da8818d19 100644 --- a/ctdb/lib/tdb/common/lock.c +++ b/ctdb/lib/tdb/common/lock.c @@ -861,3 +861,23 @@ void tdb_release_transaction_locks(struct tdb_context *tdb) SAFE_FREE(tdb->lockrecs); } } + +int tdb_transaction_write_lock_mark(struct tdb_context *tdb) +{ + return tdb_transaction_lock(tdb, F_WRLCK, TDB_LOCK_MARK_ONLY); +} + +int tdb_transaction_write_lock(struct tdb_context *tdb) +{ + return tdb_transaction_lock(tdb, F_WRLCK, 0); +} + +int tdb_transaction_write_unlock(struct tdb_context *tdb) +{ + return tdb_transaction_unlock(tdb, F_WRLCK); +} + +int tdb_transaction_write_lock_unmark(struct tdb_context *tdb) +{ + return tdb_nest_unlock(tdb, TRANSACTION_LOCK, F_WRLCK, true); +} diff --git a/ctdb/lib/tdb/include/tdb.h b/ctdb/lib/tdb/include/tdb.h index aac7c9221de..536a0b37372 100644 --- a/ctdb/lib/tdb/include/tdb.h +++ b/ctdb/lib/tdb/include/tdb.h @@ -161,6 +161,10 @@ _PUBLIC_ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); _PUBLIC_ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); _PUBLIC_ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); _PUBLIC_ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_transaction_write_lock(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_write_unlock(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_write_lock_mark(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_write_lock_unmark(struct tdb_context *tdb); _PUBLIC_ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr); |