You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. --- a/lock/lock.c
  2. +++ b/lock/lock.c
  3. @@ -1274,10 +1274,12 @@ __lock_put_internal(lt, lockp, obj_ndx,
  4. SH_TAILQ_REMOVE(
  5. &lt->obj_tab[obj_ndx], sh_obj, links, __db_lockobj);
  6. if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) {
  7. - LOCK_REGION_LOCK(env);
  8. + if (region->part_t_size != 1)
  9. + LOCK_REGION_LOCK(env);
  10. __env_alloc_free(&lt->reginfo,
  11. SH_DBT_PTR(&sh_obj->lockobj));
  12. - LOCK_REGION_UNLOCK(env);
  13. + if (region->part_t_size != 1)
  14. + LOCK_REGION_UNLOCK(env);
  15. }
  16. SH_TAILQ_INSERT_HEAD(
  17. &FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj);
  18. @@ -1467,15 +1469,21 @@ retry: SH_TAILQ_FOREACH(sh_obj, &lt->obj
  19. if (obj->size <= sizeof(sh_obj->objdata))
  20. p = sh_obj->objdata;
  21. else {
  22. - LOCK_REGION_LOCK(env);
  23. + /*
  24. + * If we have only one partition, the region is locked.
  25. + */
  26. + if (region->part_t_size != 1)
  27. + LOCK_REGION_LOCK(env);
  28. if ((ret =
  29. __env_alloc(&lt->reginfo, obj->size, &p)) != 0) {
  30. __db_errx(env,
  31. "No space for lock object storage");
  32. - LOCK_REGION_UNLOCK(env);
  33. + if (region->part_t_size != 1)
  34. + LOCK_REGION_UNLOCK(env);
  35. goto err;
  36. }
  37. - LOCK_REGION_UNLOCK(env);
  38. + if (region->part_t_size != 1)
  39. + LOCK_REGION_UNLOCK(env);
  40. }
  41. memcpy(p, obj->data, obj->size);