tdb2: rework lock.c functions to return enum TDB_ERROR.