Skip to contentSkip to conversation

generic: test zero-byte writes to file

PATCH In review Eric Sandeen 3 participants 3 messages Feb 28, 2025 – Mar 1, 2025

lore
Share & tools
lore
#0 lore raw

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
new file mode 100755
index 00000000..25eb88b9
@@ -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
new file mode 100644
index 00000000..918f5455
@@ -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)
Reviewed-by on v2 1/1
#1 lore raw

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.

---

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 +0 -0
new file mode 100755
index 00000000..25eb88b9

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
+exit
tests/generic/762.out new file +3 -0
new file mode 100644
index 00000000..918f5455
@@ -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)
Reviewed-by on v2 1/1
#2 lore raw
In reply to Eric Sandeen
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.

---

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. ;)

Sure Eric, thanks!

Quoted 19 lines
tests/generic/762 new file +12 -0
new file mode 100755
index 00000000..25eb88b9
@@ -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
+exit
tests/generic/762.out new file +3 -0
new file mode 100644
index 00000000..918f5455
@@ -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)