From: Eric Sandeen Date: Fri, 28 Feb 2025 15:13:19 +0000 (-0600) Subject: generic: test zero-byte writes to file X-Git-Tag: v2025.03.09~81 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4acec85f99bc2b928f7375c87586a23ba09242d8;p=xfstests-dev.git 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. Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- diff --git a/tests/generic/763 b/tests/generic/763 new file mode 100755 index 00000000..d78537ef --- /dev/null +++ b/tests/generic/763 @@ -0,0 +1,29 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test No. 763 +# +# 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/763.out b/tests/generic/763.out new file mode 100644 index 00000000..911c19f1 --- /dev/null +++ b/tests/generic/763.out @@ -0,0 +1,3 @@ +QA output created by 763 +wrote 0/0 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)