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

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



On 2/13/25 1:51 PM, Darrick J. Wong wrote:
> On Thu, Feb 13, 2025 at 12:06:24PM -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>
>> ---
>>
>> diff --git a/tests/generic/761 b/tests/generic/761
>> new file mode 100755
>> index 00000000..e933eb83
>> --- /dev/null
>> +++ b/tests/generic/761
>> @@ -0,0 +1,28 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2025 Red Hat, Inc.  All Rights Reserved.
>> +#
>> +# FS QA Test 761
>> +#
>> +# 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 and the zero-byte file should be created.
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto quick
>> +
>> +[ "$FSTYP" = "exfat" ] && _fixed_by_kernel_commit dda0407a2026 \
>> +	"exfat: short-circuit zero-byte writes in exfat_file_write_iter"
>> +
>> +# Modify as appropriate.
>> +_require_test
>> +
>> +rm -f $TEST_DIR/testfile.$seq
>> +$XFS_IO_PROG -f -c "pwrite 0 0" $TEST_DIR/testfile.$seq
>> +test -f $TEST_DIR/testfile.$seq || _fail "file not created"
> 
> When does the file not get created?

In some unknown error case? ;)
There's probably no reason for that test, though of course
it's still expected to pass.

In the various discussions of the exfat bug scattered around
the internet people kept pointing out that "well, the file does
get created" so I probably had that on my mind.

-Eric

> --D
> 
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/generic/761.out b/tests/generic/761.out
>> new file mode 100644
>> index 00000000..72ebba4c
>> --- /dev/null
>> +++ b/tests/generic/761.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 761
>> +Silence is golden
>>
>>
> 





[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