"Richard W.M. Jones" <rjones(a)redhat.com> writes:
On Thu, Oct 23, 2025 at 06:45:33PM +0200, Arsen Arsenović wrote:
> "Richard W.M. Jones" <rjones(a)redhat.com> writes:
>
> > I was definitely expecting this one to fail with ENOTSUP or similar.
> > That's with the file copy-allocated-destination-zero-synch.out on ZFS?
>
> Yes - my home directory is on ZoL, and so is ~/tmp.
It appears this is a limitation of OpenZFS:
https://github.com/openzfs/zfs/blob/fc519b2c1108b52aaad63e356645f63c2c167...
I figured that might be the case. ZFS has a few instances of similar
issues.
<quote>
* The original mode=0 (allocate space) behavior can be reasonably emulated
* by checking if enough space exists and creating a sparse file, as real
* persistent space reservation is not possible due to COW, snapshots, etc.
</quote>
Looking at the code when mode == 0, I believe we hit the second case
(line 707), which seems to sparsify the file and (if that succeeeds)
returns no error :-(
We should probably add a 'requires' to the test. I think it could
still be a bug in libnbd that we don't fail if fallocate fails, but it
wouldn't have helped here.
A reasonable check might be to check whether a truncated file has zero
blocks, I suppose.
--
Arsen Arsenović