- hash_size = (1ULL << tdb->header.v.hash_bits);
- if (tdb_lock_gradual(tdb, ltype, TDB_HASH_LOCK_START,
- 1ULL << tdb->header.v.hash_bits, flags)) {
+ /* Lock hashes, gradually. */
+ if (tdb_lock_gradual(tdb, ltype, flags, TDB_HASH_LOCK_START,
+ TDB_HASH_LOCK_RANGE)) {
+ if (!(flags & TDB_LOCK_PROBE)) {
+ tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
+ "tdb_allrecord_lock hashes failed (%s)\n",
+ strerror(errno));
+ }
+ return -1;
+ }
+
+ /* Lock free lists: there to end of file. */
+ if (tdb_brlock(tdb, ltype, TDB_HASH_LOCK_START + TDB_HASH_LOCK_RANGE,
+ 0, flags)) {