]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/dnode.c
OpenZFS 9438 - Holes can lose birth time info if a block has a mix of birth times
authorPaul Dagnelie <pcd@delphix.com>
Tue, 20 Sep 2016 17:02:29 +0000 (10:02 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 30 Jul 2018 16:27:49 +0000 (09:27 -0700)
commit21d48b5eac54ba7b2e4d8bf0d0e747082e0e8577
tree06c38b83d34d34f8a22ff3a0c6ce16de00baafcf
parentb719768e35fdd6d4052546338453cee0713a1a3c
OpenZFS 9438 - Holes can lose birth time info if a block has a mix of birth times

As reported by https://github.com/zfsonlinux/zfs/issues/4996, there is
yet another hole birth issue. In this one, if a block is entirely holes,
but the birth times are not all the same, we lose that information by
creating one hole with the current txg as its birth time.

The ZoL PR's fix approach is incorrect. Ultimately, the problem here is
that when you truncate and write a file in the same transaction group,
the dbuf for the indirect block will be zeroed out to deal with the
truncation, and then written for the write. During this process, we will
lose hole birth time information for any holes in the range. In the case
where a dnode is being freed, we need to determine whether the block
should be converted to a higher-level hole in the zio pipeline, and if
so do it when the dnode is being synced out.

Porting Notes:
* The DMU_OBJECT_END change in zfs_znode.c was already applied.
* Added test cases from #5675 provided by @rincebrain for hole_birth
  issues.  These test cases should be pushed upstream to OpenZFS.
* Updated mk_files which is used by several rsend tests so the
  files created are a little more interesting and may contain holes.

Authored by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/9438
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/738e2a3c
External-issue: DLPX-46861
Closes #7746
module/zfs/dmu_object.c
module/zfs/dnode.c
module/zfs/dnode_sync.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/rsend/Makefile.am
tests/zfs-tests/tests/functional/rsend/rsend.kshlib
tests/zfs-tests/tests/functional/rsend/send_hole_birth.ksh [new file with mode: 0755]