* [PATCH] generic: test zero-byte writes to new file @ 2025-02-13 18:06 Eric Sandeen 2025-02-13 19:51 ` Darrick J. Wong 2025-02-21 5:14 ` Nirjhar Roy (IBM) 0 siblings, 2 replies; 14+ messages in thread From: Eric Sandeen @ 2025-02-13 18:06 UTC (permalink / raw) To: fstests@vger.kernel.org; +Cc: Namjae Jeon 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" + +# 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 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-13 18:06 [PATCH] generic: test zero-byte writes to new file Eric Sandeen @ 2025-02-13 19:51 ` Darrick J. Wong 2025-02-13 20:50 ` Eric Sandeen 2025-02-21 5:14 ` Nirjhar Roy (IBM) 1 sibling, 1 reply; 14+ messages in thread From: Darrick J. Wong @ 2025-02-13 19:51 UTC (permalink / raw) To: Eric Sandeen; +Cc: fstests@vger.kernel.org, Namjae Jeon 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 > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-13 19:51 ` Darrick J. Wong @ 2025-02-13 20:50 ` Eric Sandeen 2025-02-14 3:17 ` Eric Sandeen 0 siblings, 1 reply; 14+ messages in thread From: Eric Sandeen @ 2025-02-13 20:50 UTC (permalink / raw) To: Darrick J. Wong; +Cc: fstests@vger.kernel.org, Namjae Jeon 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 >> >> > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-13 20:50 ` Eric Sandeen @ 2025-02-14 3:17 ` Eric Sandeen 2025-02-14 4:02 ` Darrick J. Wong 0 siblings, 1 reply; 14+ messages in thread From: Eric Sandeen @ 2025-02-14 3:17 UTC (permalink / raw) To: Darrick J. Wong; +Cc: fstests@vger.kernel.org, Namjae Jeon 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-14 3:17 ` Eric Sandeen @ 2025-02-14 4:02 ` Darrick J. Wong 2025-02-14 5:46 ` Namjae Jeon 2025-02-14 14:36 ` Eric Sandeen 0 siblings, 2 replies; 14+ messages in thread From: Darrick J. Wong @ 2025-02-14 4:02 UTC (permalink / raw) To: Eric Sandeen; +Cc: fstests@vger.kernel.org, Namjae Jeon 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 > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-14 4:02 ` Darrick J. Wong @ 2025-02-14 5:46 ` Namjae Jeon 2025-02-14 14:36 ` Eric Sandeen 1 sibling, 0 replies; 14+ messages in thread From: Namjae Jeon @ 2025-02-14 5:46 UTC (permalink / raw) To: Darrick J. Wong; +Cc: Eric Sandeen, fstests@vger.kernel.org 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 > > > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-14 4:02 ` Darrick J. Wong 2025-02-14 5:46 ` Namjae Jeon @ 2025-02-14 14:36 ` Eric Sandeen 2025-02-18 17:39 ` Darrick J. Wong 1 sibling, 1 reply; 14+ messages in thread From: Eric Sandeen @ 2025-02-14 14:36 UTC (permalink / raw) To: Darrick J. Wong, Eric Sandeen; +Cc: fstests@vger.kernel.org, Namjae Jeon 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 >> >> > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-14 14:36 ` Eric Sandeen @ 2025-02-18 17:39 ` Darrick J. Wong 2025-02-21 16:07 ` Eric Sandeen 0 siblings, 1 reply; 14+ messages in thread From: Darrick J. Wong @ 2025-02-18 17:39 UTC (permalink / raw) To: Eric Sandeen; +Cc: Eric Sandeen, fstests@vger.kernel.org, Namjae Jeon 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 > >> > >> > > > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-18 17:39 ` Darrick J. Wong @ 2025-02-21 16:07 ` Eric Sandeen 0 siblings, 0 replies; 14+ messages in thread From: Eric Sandeen @ 2025-02-21 16:07 UTC (permalink / raw) To: Darrick J. Wong; +Cc: Eric Sandeen, fstests@vger.kernel.org, Namjae Jeon On 2/18/25 9:39 AM, Darrick J. Wong wrote: > On Fri, Feb 14, 2025 at 08:36:25AM -0600, Eric Sandeen wrote: ... >> 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? I can. I'm OOTO for a bit so it may be a while, but this isn't urgent. I'll get to it. Thanks, -Eric > --D ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-13 18:06 [PATCH] generic: test zero-byte writes to new file Eric Sandeen 2025-02-13 19:51 ` Darrick J. Wong @ 2025-02-21 5:14 ` Nirjhar Roy (IBM) 2025-02-21 16:47 ` Darrick J. Wong 1 sibling, 1 reply; 14+ messages in thread From: Nirjhar Roy (IBM) @ 2025-02-21 5:14 UTC (permalink / raw) To: Eric Sandeen, fstests@vger.kernel.org; +Cc: Namjae Jeon 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 > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-21 5:14 ` Nirjhar Roy (IBM) @ 2025-02-21 16:47 ` Darrick J. Wong 2025-02-24 4:39 ` Nirjhar Roy (IBM) 2025-02-25 22:29 ` Eric Sandeen 0 siblings, 2 replies; 14+ messages in thread From: Darrick J. Wong @ 2025-02-21 16:47 UTC (permalink / raw) To: Nirjhar Roy (IBM); +Cc: Eric Sandeen, fstests@vger.kernel.org, Namjae Jeon On Fri, Feb 21, 2025 at 10:44:09AM +0530, Nirjhar Roy (IBM) wrote: > 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? Agreed, the _cleanup should remove the testfile. Using the scratch device (== additional runtime for mkfs) is overkill since this test creates a single file but writes nothing to it. --D > --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 > > > > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-21 16:47 ` Darrick J. Wong @ 2025-02-24 4:39 ` Nirjhar Roy (IBM) 2025-02-25 22:29 ` Eric Sandeen 1 sibling, 0 replies; 14+ messages in thread From: Nirjhar Roy (IBM) @ 2025-02-24 4:39 UTC (permalink / raw) To: Darrick J. Wong; +Cc: Eric Sandeen, fstests@vger.kernel.org, Namjae Jeon On 2/21/25 22:17, Darrick J. Wong wrote: > On Fri, Feb 21, 2025 at 10:44:09AM +0530, Nirjhar Roy (IBM) wrote: >> 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? > Agreed, the _cleanup should remove the testfile. > > Using the scratch device (== additional runtime for mkfs) is overkill > since this test creates a single file but writes nothing to it. Yes, makes sense. --NR > > --D > >> --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 >>> >> -- Nirjhar Roy Linux Kernel Developer IBM, Bangalore ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-21 16:47 ` Darrick J. Wong 2025-02-24 4:39 ` Nirjhar Roy (IBM) @ 2025-02-25 22:29 ` Eric Sandeen 2025-02-26 10:57 ` Zorro Lang 1 sibling, 1 reply; 14+ messages in thread From: Eric Sandeen @ 2025-02-25 22:29 UTC (permalink / raw) To: Darrick J. Wong, Nirjhar Roy (IBM); +Cc: fstests@vger.kernel.org, Namjae Jeon On 2/21/25 8:47 AM, Darrick J. Wong wrote: > On Fri, Feb 21, 2025 at 10:44:09AM +0530, Nirjhar Roy (IBM) wrote: >> 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? > > Agreed, the _cleanup should remove the testfile. ok. I thought we left stuff lying around to age test, but I'll do whatever folks like to get this one-liner test merged :) -Eric ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] generic: test zero-byte writes to new file 2025-02-25 22:29 ` Eric Sandeen @ 2025-02-26 10:57 ` Zorro Lang 0 siblings, 0 replies; 14+ messages in thread From: Zorro Lang @ 2025-02-26 10:57 UTC (permalink / raw) To: Eric Sandeen Cc: Darrick J. Wong, Nirjhar Roy (IBM), fstests@vger.kernel.org, Namjae Jeon On Tue, Feb 25, 2025 at 04:29:29PM -0600, Eric Sandeen wrote: > On 2/21/25 8:47 AM, Darrick J. Wong wrote: > > On Fri, Feb 21, 2025 at 10:44:09AM +0530, Nirjhar Roy (IBM) wrote: > >> 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? > > > > Agreed, the _cleanup should remove the testfile. > > ok. I thought we left stuff lying around to age test, but I'll do whatever > folks like to get this one-liner test merged :) Actually there's not a rule about "must remove the file your create in TEST_DIR". And I remember the TEST_DIR was designed to keep some random files. So from my side, if the file size isn't too large, I'm good to keep it in TEST_DIR :) Thanks, Zorro > > -Eric > > ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-26 10:58 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-02-13 18:06 [PATCH] generic: test zero-byte writes to new file Eric Sandeen 2025-02-13 19:51 ` Darrick J. Wong 2025-02-13 20:50 ` Eric Sandeen 2025-02-14 3:17 ` Eric Sandeen 2025-02-14 4:02 ` Darrick J. Wong 2025-02-14 5:46 ` Namjae Jeon 2025-02-14 14:36 ` Eric Sandeen 2025-02-18 17:39 ` Darrick J. Wong 2025-02-21 16:07 ` Eric Sandeen 2025-02-21 5:14 ` Nirjhar Roy (IBM) 2025-02-21 16:47 ` Darrick J. Wong 2025-02-24 4:39 ` Nirjhar Roy (IBM) 2025-02-25 22:29 ` Eric Sandeen 2025-02-26 10:57 ` Zorro Lang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox