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

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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

Sure Eric, thanks!

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

I'll remove this comment ^^ when I merge it.

Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx>

> +_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)
> 
> 





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux