mbox series

[0/2] block/fuse: Let PUNCH_HOLE write zeroes

Message ID 20230227104725.33511-1-hreitz@redhat.com (mailing list archive)
Headers show
Series block/fuse: Let PUNCH_HOLE write zeroes | expand

Message

Hanna Czenczek Feb. 27, 2023, 10:47 a.m. UTC
Hi,

https://gitlab.com/qemu-project/qemu/-/issues/1507 reports a bug in FUSE
exports: fallocate(PUNCH_HOLE) is implemented with blk_pdiscard(), but
its man page documents that a successful call will result in the data
being read as zero.  blk_pdiscard() does not guarantee this, so we must
use blk_pwrite_zeroes() instead (with MAY_UNMAP | NO_FALLBACK, which
differentiates it from fallocate(ZERO_RANGE)).

Patch 2 adds a regression test.


Hanna Czenczek (2):
  block/fuse: Let PUNCH_HOLE write zeroes
  iotests/308: Add test for 'write -zu'

 block/export/fuse.c        | 11 +++++++++-
 tests/qemu-iotests/308     | 43 ++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/308.out | 35 +++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletion(-)

Comments

Kevin Wolf March 7, 2023, 2:23 p.m. UTC | #1
Am 27.02.2023 um 11:47 hat Hanna Czenczek geschrieben:
> Hi,
> 
> https://gitlab.com/qemu-project/qemu/-/issues/1507 reports a bug in FUSE
> exports: fallocate(PUNCH_HOLE) is implemented with blk_pdiscard(), but
> its man page documents that a successful call will result in the data
> being read as zero.  blk_pdiscard() does not guarantee this, so we must
> use blk_pwrite_zeroes() instead (with MAY_UNMAP | NO_FALLBACK, which
> differentiates it from fallocate(ZERO_RANGE)).
> 
> Patch 2 adds a regression test.

Thanks, applied to the block branch.

Kevin