generic: test zero-byte writes to file
PATCH v2 1/1 generic: test zero-byte writes to file
A bug was recently fixed in exfat where attempting to do a zero-byte write would yield -EFAULT; test for that here.
---
V2: remove the test that file exists, fix .out file and filter xfs_io
Zorro - If there is more debate over whether or not the file should be removed at the end of the test, please feel free to fix it up to whatever makes the most people happy. ;)
tests/generic/762 new file +29 -0
@@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 762 +# +# test zero-byte writes +# +# exfat had a regression where a zero-byte write to a file would +# yield -EfAULT. Should work on all filesystems - write should +# succeed. +# +. ./common/preamble +_begin_fstest auto quick + +# Import common functions. +. ./common/filter + +[ "$FSTYP" = "exfat" ] && _fixed_by_kernel_commit dda0407a2026 \ + "exfat: short-circuit zero-byte writes in exfat_file_write_iter" + +# Modify as appropriate. +_require_test + +$XFS_IO_PROG -f -c "pwrite 0 0" $TEST_DIR/testfile.$seq 2>&1 | _filter_xfs_io + +# success, all done +status=0 +exit
tests/generic/762.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 762 +wrote 0/0 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
tests/generic/762
Quoted 17 lines · Eric Sandeen
A bug was recently fixed in exfat where attempting to do a zero-byte write would yield
-EFAULT; test for that here.Signed-off-by Eric Sandeen <[email protected]>---
V2: remove the test that file exists, fix .out file and filter
xfs_ioZorro - If there is more debate over whether or not the file should be removed at the end of the test, please feel free to fix it up to whatever makes the most people happy. ;)
tests/generic/762 new file +0
-0
Hee hee, another generic/762 :)
Looks good to me,
--D
Quoted 41 lines
tests/generic/762 new file +29
-0@@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 762 +# +# test zero-byte writes +# +# exfat had a regression where a zero-byte write to a file would +# yield -EfAULT. Should work on all filesystems - write should +# succeed. +# +. ./common/preamble +_begin_fstest auto quick + +# Import common functions. +. ./common/filter + +[ "$FSTYP" = "exfat" ] && _fixed_by_kernel_commit dda0407a2026 \ + "exfat: short-circuit zero-byte writes in exfat_file_write_iter" + +# Modify as appropriate. +_require_test + +$XFS_IO_PROG -f -c "pwrite 0 0" $TEST_DIR/testfile.$seq 2>&1 | _filter_xfs_io + +# success, all done +status=0 +exittests/generic/762.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 762 +wrote 0/0 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Quoted 11 lines · Eric Sandeen
A bug was recently fixed in exfat where attempting to do a zero-byte write would yield
-EFAULT; test for that here.Signed-off-by Eric Sandeen <[email protected]>---
V2: remove the test that file exists, fix .out file and filter
xfs_ioZorro - If there is more debate over whether or not the file should be removed at the end of the test, please feel free to fix it up to whatever makes the most people happy. ;)
Sure Eric, thanks!
Quoted 19 lines
tests/generic/762 new file +12
-0@@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 762 +# +# test zero-byte writes +# +# exfat had a regression where a zero-byte write to a file would +# yield -EfAULT. Should work on all filesystems - write should +# succeed. +#
tests/generic/762 line 22
Quoted 10 lines
tests/generic/762 new file +10
-0+. ./common/preamble +_begin_fstest auto quick + +# Import common functions. +. ./common/filter + +[ "$FSTYP" = "exfat" ] && _fixed_by_kernel_commit dda0407a2026 \ + "exfat: short-circuit zero-byte writes in exfat_file_write_iter" + +# Modify as appropriate.
I'll remove this comment ^^ when I merge it.
Quoted 18 lines
tests/generic/762 new file +7
-0+_require_test + +$XFS_IO_PROG -f -c "pwrite 0 0" $TEST_DIR/testfile.$seq 2>&1 | _filter_xfs_io + +# success, all done +status=0 +exittests/generic/762.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 762 +wrote 0/0 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)