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 <sandeen@xxxxxxxxxx> --- 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. ;) diff --git a/tests/generic/762 b/tests/generic/762 new file mode 100755 index 00000000..25eb88b9 --- /dev/null +++ b/tests/generic/762 @@ -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 diff --git a/tests/generic/762.out b/tests/generic/762.out new file mode 100644 index 00000000..918f5455 --- /dev/null +++ b/tests/generic/762.out @@ -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)