Message ID | b4d76883-e58b-4db3-b7e4-7ddeb5ec7f42@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | generic: test zero-byte writes to new file | expand |
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@redhat.com> > --- > > 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? --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 > >
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@redhat.com> >> --- >> >> 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 >> >> >
On 2/13/25 2:50 PM, Eric Sandeen wrote: > On 2/13/25 1:51 PM, Darrick J. Wong wrote: ... >>> +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. To put a finer point on it, because I can't tell for sure - are you asking me to take that test out? Thanks, -Eric
On Thu, Feb 13, 2025 at 09:17:28PM -0600, Eric Sandeen wrote: > On 2/13/25 2:50 PM, Eric Sandeen wrote: > > On 2/13/25 1:51 PM, Darrick J. Wong wrote: > > ... > > >>> +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. > > To put a finer point on it, because I can't tell for sure - are > you asking me to take that test out? Nah, I was just wondering if there was something about the buggy exfat code that either prevented the file from being created, or if the bug was that the empty file got deleted after the zero-byte pwrite and I misunderstood what's going on. (IOWs I think this test is fine, but could the exfat maintainer clarify?) --D > Thanks, > -Eric > >
On Fri, Feb 14, 2025 at 1:02 PM Darrick J. Wong <djwong@kernel.org> wrote: > > On Thu, Feb 13, 2025 at 09:17:28PM -0600, Eric Sandeen wrote: > > On 2/13/25 2:50 PM, Eric Sandeen wrote: > > > On 2/13/25 1:51 PM, Darrick J. Wong wrote: > > > > ... > > > > >>> +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. > > > > To put a finer point on it, because I can't tell for sure - are > > you asking me to take that test out? > > Nah, I was just wondering if there was something about the buggy exfat > code that either prevented the file from being created, or if the bug > was that the empty file got deleted after the zero-byte pwrite and I > misunderstood what's going on. > > (IOWs I think this test is fine, but could the exfat maintainer > clarify?) File was not deleted due to a bug in exFAT. It has caused a misunderstanding because exFAT returns an incorrect errno (-EFAULT) from zero length write. Thanks. > > --D > > > Thanks, > > -Eric > > > >
On 2/13/25 10:02 PM, Darrick J. Wong wrote: > On Thu, Feb 13, 2025 at 09:17:28PM -0600, Eric Sandeen wrote: >> On 2/13/25 2:50 PM, Eric Sandeen wrote: >>> On 2/13/25 1:51 PM, Darrick J. Wong wrote: >> >> ... >> >>>>> +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. >> >> To put a finer point on it, because I can't tell for sure - are >> you asking me to take that test out? > > Nah, I was just wondering if there was something about the buggy exfat > code that either prevented the file from being created, or if the bug > was that the empty file got deleted after the zero-byte pwrite and I > misunderstood what's going on. Ah, I see. No, the observable problem was an -EFAULT on the write, and the file /does/ get created as expected. The test probably is extraneous to the original bug, because of course open(O_CREAT) and write(0) are two separate operations. I was just a bit over-eager when writing the test. Thanks, -Eric > (IOWs I think this test is fine, but could the exfat maintainer > clarify?) > > --D > >> Thanks, >> -Eric >> >> >
On Fri, Feb 14, 2025 at 08:36:25AM -0600, Eric Sandeen wrote: > On 2/13/25 10:02 PM, Darrick J. Wong wrote: > > On Thu, Feb 13, 2025 at 09:17:28PM -0600, Eric Sandeen wrote: > >> On 2/13/25 2:50 PM, Eric Sandeen wrote: > >>> On 2/13/25 1:51 PM, Darrick J. Wong wrote: > >> > >> ... > >> > >>>>> +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. > >> > >> To put a finer point on it, because I can't tell for sure - are > >> you asking me to take that test out? > > > > Nah, I was just wondering if there was something about the buggy exfat > > code that either prevented the file from being created, or if the bug > > was that the empty file got deleted after the zero-byte pwrite and I > > misunderstood what's going on. > > Ah, I see. No, the observable problem was an -EFAULT on the write, > and the file /does/ get created as expected. The test probably is > extraneous to the original bug, because of course open(O_CREAT) and > write(0) are two separate operations. I was just a bit over-eager > when writing the test. <nod> Would you mind resending, but with the rm removed? --D > Thanks, > -Eric > > > (IOWs I think this test is fine, but could the exfat maintainer > > clarify?) > > > > --D > > > >> Thanks, > >> -Eric > >> > >> > > > >
On Thu, 2025-02-13 at 12:06 -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> > --- > > 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" Minor: Maybe just remove the test file that is created above (since we are using the TEST_DIR)and not leave any test artifacts? Or, maybe use the scratch device? --NR > + > +# 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 >
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" + +# 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
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> ---