assert(len_with_header >= sizeof(struct tdb_free_record));
len = len_with_header - sizeof(struct tdb_used_record);
b_off = bucket_off(tdb->ftable_off, size_to_bucket(len));
assert(len_with_header >= sizeof(struct tdb_free_record));
len = len_with_header - sizeof(struct tdb_used_record);
b_off = bucket_off(tdb->ftable_off, size_to_bucket(len));
- if (tdb_lock_free_bucket(tdb, b_off, TDB_LOCK_WAIT) != 0)
+ ecode = tdb_lock_free_bucket(tdb, b_off, TDB_LOCK_WAIT);
+ if (ecode != TDB_SUCCESS) {
+ tdb->ecode = ecode;
ret = enqueue_in_free(tdb, b_off, off, len);
tdb_unlock_free_bucket(tdb, b_off);
ret = enqueue_in_free(tdb, b_off, off, len);
tdb_unlock_free_bucket(tdb, b_off);
tdb_access_release(tdb, r);
/* We may be violating lock order here, so best effort. */
tdb_access_release(tdb, r);
/* We may be violating lock order here, so best effort. */
struct tdb_free_record best = { 0 };
double multiplier;
size_t size = adjust_size(keylen, datalen);
struct tdb_free_record best = { 0 };
double multiplier;
size_t size = adjust_size(keylen, datalen);
- if (tdb_lock_free_bucket(tdb, b_off, TDB_LOCK_WAIT) == -1) {
+ ecode = tdb_lock_free_bucket(tdb, b_off, TDB_LOCK_WAIT);
+ if (ecode != TDB_SUCCESS) {
+ tdb->ecode = ecode;
wanted = adjust_size(0, wanted);
/* Only one person can expand file at a time. */
wanted = adjust_size(0, wanted);
/* Only one person can expand file at a time. */
/* Someone else may have expanded the file, so retry. */
old_size = tdb->map_size;
/* Someone else may have expanded the file, so retry. */
old_size = tdb->map_size;