]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic: test zero-byte writes to file
authorEric Sandeen <sandeen@redhat.com>
Fri, 28 Feb 2025 15:13:19 +0000 (09:13 -0600)
committerZorro Lang <zlang@kernel.org>
Thu, 6 Mar 2025 10:12:35 +0000 (18:12 +0800)
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@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/763 [new file with mode: 0755]
tests/generic/763.out [new file with mode: 0644]

diff --git a/tests/generic/763 b/tests/generic/763
new file mode 100755 (executable)
index 0000000..d78537e
--- /dev/null
@@ -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 (file)
index 0000000..911c19f
--- /dev/null
@@ -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)