diff mbox series

[V2] generic: test zero-byte writes to file

Message ID 3bd585ba-fe21-4f93-802a-f32f9e0f1c61@redhat.com (mailing list archive)
State New
Headers show
Series [V2] generic: test zero-byte writes to file | expand

Commit Message

Eric Sandeen Feb. 28, 2025, 3:13 p.m. UTC
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>
---

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

Comments

Darrick J. Wong Feb. 28, 2025, 5:18 p.m. UTC | #1
On Fri, Feb 28, 2025 at 09:13:19AM -0600, Eric Sandeen wrote:
> 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>
> ---
> 
> 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

Hee hee, another generic/762 :)

Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> @@ -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)
> 
>
diff mbox series

Patch

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)