zfsonlinux/zfs — pull request #2689 by FransUrbo (2014-09-12 03:31:53+00:00)
Title: Illumos 3693 - restore_object uses at least two transactions to restore an object

restore_object uses at least two transactions to restore an object:

* one transaction is used for dmu_object_claim
* another transaction is used to set compression, checksum and most
importantly bonus data
* furthermore dmu_object_reclaim internally uses multiple transactions
* dmu_free_long_range frees chunks in separate transactions
* dnode_reallocate is executed in a distinct transaction

The fact the dnode_allocate/dnode_reallocate are executed in one
transaction and bonus (re-)population is executed in a different
transaction may lead to violation of ZFS consistency assertions if the
transactions are assigned to different transaction groups. Also, if
the first transaction group is successfully written to a permanent
storage, but the second transaction is lost, then an invalid dnode may
be created on the stable storage.

Reviewed by: Christopher Siden christopher.siden@delphix.com
Reviewed by: George Wilson george.wilson@delphix.com

Original authors: Matthew Ahrens and Andriy Gapon

References:
https://www.illumos.org/projects/illumos-gate//issues/3693
https://reviews.csiden.org/r/90

Ported by: Turbo Fredriksson