I have recently discovered that there is another scenario where new holes are 
treated as old in a sparse file. This happens, for instance, if on truncates a 
file, then writes past the end of file leaving a hole that is large enough to 
cover an Ln range (n >= 1), and then partially overwrites that hole. (The 
hole_birth feature is assumed active). Please see the discussion in zfsonlinux 
issue zfsonlinux/zfs#4050 for a command listing to reproduce the problem.

When the metadata hole (say L1) is created, it's block pointer is correctly 
initialized with the non-zero birth epoch. But when the overwrite occurs, the 
new metadata block that will contain the new non-hole block pointers is 
allocated, and only the new block pointers are initialized, leaving the rest of 
the block pointers zeroed out. This in turn results in creation of a number of 
"old" holes that should have been new.

Another easy way to reproduce this issue is by punching holes in files or zvols 
(e.g. using blkdiscard utility on Linux against a zvol-backed block device). 
Indeed, this issue is common for both files and zvols as it relates to the way 
new metadata blocks are initialized when created.

---
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/37#issuecomment-161772640
_______________________________________________
developer mailing list
developer@open-zfs.org
http://lists.open-zfs.org/mailman/listinfo/developer

Reply via email to