]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/dmu.c
Illumos 3693 - restore_object uses at least two transactions to restore an object
authorMatthew Ahrens <mahrens@delphix.com>
Fri, 12 Sep 2014 03:28:35 +0000 (05:28 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 21 Oct 2014 22:26:50 +0000 (15:26 -0700)
commit6c59307a3c52535513e1ea3b612dac5a594c5b5d
tree354e056c4e1bfca9feafc741cb6d5e3b775cf77b
parent356d9ed4c81dbb1c52627d1af242f4d9f66b67af
Illumos 3693 - restore_object uses at least two transactions to restore an object

Restore_object should not use 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.

3693 restore_object uses at least two transactions to restore an object
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Andriy Gapon <andriy.gapon@hybridcluster.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Original authors: Matthew Ahrens and Andriy Gapon

References:
  https://www.illumos.org/issues/3693
  https://github.com/illumos/illumos-gate/commit/e77d42e

Ported by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2689
include/sys/dmu.h
module/zfs/dmu.c
module/zfs/dmu_object.c
module/zfs/dmu_send.c