HomeFreeBSD

Deny block cloning is dbuf size doesn't match BP size.

Description

Deny block cloning is dbuf size doesn't match BP size.

I don't know an easy way to shrink down dbuf size, so just deny block cloning
into dbufs that don't match our BP's size.

This fixes the following situation:

  1. Create a small file, eg. 1kB of random bytes. Its dbuf will be 1kB.
  2. Create a larger file, eg. 2kB of random bytes. Its dbuf will be 2kB.
  3. Truncate the large file to 0. Its dbuf will remain 2kB.
  4. Clone the small file into the large file. Small file's BP lsize is 1kB, but the large file's dbuf is 2kB.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14825

Details

Provenance
pjdAuthored on May 2 2023, 9:24 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on May 11 2023, 11:06 PM
Parents
rG555ef90c5c1d: Additional block cloning fixes.
Branches
Unknown
Tags
Unknown