summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tdb2/tdb1_lock.c')
-rw-r--r--lib/tdb2/tdb1_lock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/tdb2/tdb1_lock.c b/lib/tdb2/tdb1_lock.c
index 6498b71367..65fa1c123c 100644
--- a/lib/tdb2/tdb1_lock.c
+++ b/lib/tdb2/tdb1_lock.c
@@ -392,25 +392,30 @@ int tdb1_unlockall_read(struct tdb1_context *tdb)
contention - it cannot guarantee how many records will be locked */
int tdb1_chainlock(struct tdb1_context *tdb, TDB_DATA key)
{
- int ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
+ int ret = tdb1_lock(tdb,
+ TDB1_BUCKET(tdb_hash(tdb, key.dptr, key.dsize)),
+ F_WRLCK);
return ret;
}
int tdb1_chainunlock(struct tdb1_context *tdb, TDB_DATA key)
{
- return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
+ return tdb1_unlock(tdb, TDB1_BUCKET(tdb_hash(tdb, key.dptr, key.dsize)),
+ F_WRLCK);
}
int tdb1_chainlock_read(struct tdb1_context *tdb, TDB_DATA key)
{
int ret;
- ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
+ ret = tdb1_lock(tdb, TDB1_BUCKET(tdb_hash(tdb, key.dptr, key.dsize)),
+ F_RDLCK);
return ret;
}
int tdb1_chainunlock_read(struct tdb1_context *tdb, TDB_DATA key)
{
- return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
+ return tdb1_unlock(tdb, TDB1_BUCKET(tdb_hash(tdb, key.dptr, key.dsize)),
+ F_RDLCK);
}
/* record lock stops delete underneath */