* [PATCH v2] generic/623: fix test for runing on overlayfs @ 2022-06-01 12:34 Amir Goldstein 2022-06-01 23:44 ` Dave Chinner 0 siblings, 1 reply; 3+ messages in thread From: Amir Goldstein @ 2022-06-01 12:34 UTC (permalink / raw) To: Zorro Lang; +Cc: Brian Foster, Dave Chinner, fstests, linux-xfs For this test to run on overlayfs we open a different file to perform shutdown while keeping the writeback target file open. xfs_io -c fsync perform fsync also on the writeback target file, which is needed for triggering the write fault. Signed-off-by: Amir Goldstein <amir73il@gmail.com> --- Zorro, Following your comment on v1, this version does not change the behavior of the test when running on non-overlayfs. I tested that this test passes for both xfs and overlayfs+xfs on v5.18 and tested that both configs fail with the same warning on v5.10.109. Thanks, Amir. tests/generic/623 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/generic/623 b/tests/generic/623 index ea016d91..5971717c 100755 --- a/tests/generic/623 +++ b/tests/generic/623 @@ -24,10 +24,22 @@ _scratch_mount # XFS had a regression where it failed to check shutdown status in the fault # path. This produced an iomap warning because writeback failure clears Uptodate # status on the page. + +# For this test to run on overlayfs we open a different file to perform +# shutdown while keeping the writeback target file open. +# xfs_io -c fsync post-shutdown performs fsync also on the writeback target file, +# which is critical for trigerring the writeback failure. +shutdown_cmd=() +shutdown_handle="$(_scratch_shutdown_handle)" +if [ "$shutdown_handle" != "$SCRATCH_MNT" ];then + shutdown_cmd+=("-c" "open $shutdown_handle") +fi +shutdown_cmd+=("-c" "shutdown") + file=$SCRATCH_MNT/file $XFS_IO_PROG -fc "pwrite 0 4k" -c fsync $file | _filter_xfs_io ulimit -c 0 -$XFS_IO_PROG -x -c "mmap 0 4k" -c "mwrite 0 4k" -c shutdown -c fsync \ +$XFS_IO_PROG -x -c "mmap 0 4k" -c "mwrite 0 4k" "${shutdown_cmd[@]}" -c fsync \ -c "mwrite 0 4k" $file | _filter_xfs_io # success, all done -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] generic/623: fix test for runing on overlayfs 2022-06-01 12:34 [PATCH v2] generic/623: fix test for runing on overlayfs Amir Goldstein @ 2022-06-01 23:44 ` Dave Chinner 2022-06-02 4:19 ` Zorro Lang 0 siblings, 1 reply; 3+ messages in thread From: Dave Chinner @ 2022-06-01 23:44 UTC (permalink / raw) To: Amir Goldstein; +Cc: Zorro Lang, Brian Foster, fstests, linux-xfs On Wed, Jun 01, 2022 at 03:34:06PM +0300, Amir Goldstein wrote: > For this test to run on overlayfs we open a different file to perform > shutdown while keeping the writeback target file open. > > xfs_io -c fsync perform fsync also on the writeback target file, which > is needed for triggering the write fault. > > Signed-off-by: Amir Goldstein <amir73il@gmail.com> > --- > > Zorro, > > Following your comment on v1, this version does not change the > behavior of the test when running on non-overlayfs. > > I tested that this test passes for both xfs and overlayfs+xfs on v5.18 > and tested that both configs fail with the same warning on v5.10.109. > > Thanks, > Amir. > > tests/generic/623 | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/tests/generic/623 b/tests/generic/623 > index ea016d91..5971717c 100755 > --- a/tests/generic/623 > +++ b/tests/generic/623 > @@ -24,10 +24,22 @@ _scratch_mount > # XFS had a regression where it failed to check shutdown status in the fault > # path. This produced an iomap warning because writeback failure clears Uptodate > # status on the page. > + > +# For this test to run on overlayfs we open a different file to perform > +# shutdown while keeping the writeback target file open. > +# xfs_io -c fsync post-shutdown performs fsync also on the writeback target file, > +# which is critical for trigerring the writeback failure. > +shutdown_cmd=() > +shutdown_handle="$(_scratch_shutdown_handle)" > +if [ "$shutdown_handle" != "$SCRATCH_MNT" ];then > + shutdown_cmd+=("-c" "open $shutdown_handle") > +fi > +shutdown_cmd+=("-c" "shutdown") IMO, this is unnecessary complexity. The original patch with the "fsync acts on all open files" comment above explains the xfs_io fsync quirk that enables the test to do what it is supposed to be doing without any of the this conditional command construction. The less special case handling we need to splice into the test code, the better. Cheers, Dave. -- Dave Chinner david@fromorbit.com ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] generic/623: fix test for runing on overlayfs 2022-06-01 23:44 ` Dave Chinner @ 2022-06-02 4:19 ` Zorro Lang 0 siblings, 0 replies; 3+ messages in thread From: Zorro Lang @ 2022-06-02 4:19 UTC (permalink / raw) To: Dave Chinner; +Cc: Amir Goldstein, Brian Foster, fstests, linux-xfs On Thu, Jun 02, 2022 at 09:44:43AM +1000, Dave Chinner wrote: > On Wed, Jun 01, 2022 at 03:34:06PM +0300, Amir Goldstein wrote: > > For this test to run on overlayfs we open a different file to perform > > shutdown while keeping the writeback target file open. > > > > xfs_io -c fsync perform fsync also on the writeback target file, which > > is needed for triggering the write fault. > > > > Signed-off-by: Amir Goldstein <amir73il@gmail.com> > > --- > > > > Zorro, > > > > Following your comment on v1, this version does not change the > > behavior of the test when running on non-overlayfs. > > > > I tested that this test passes for both xfs and overlayfs+xfs on v5.18 > > and tested that both configs fail with the same warning on v5.10.109. > > > > Thanks, > > Amir. > > > > tests/generic/623 | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/tests/generic/623 b/tests/generic/623 > > index ea016d91..5971717c 100755 > > --- a/tests/generic/623 > > +++ b/tests/generic/623 > > @@ -24,10 +24,22 @@ _scratch_mount > > # XFS had a regression where it failed to check shutdown status in the fault > > # path. This produced an iomap warning because writeback failure clears Uptodate > > # status on the page. > > + > > +# For this test to run on overlayfs we open a different file to perform > > +# shutdown while keeping the writeback target file open. > > +# xfs_io -c fsync post-shutdown performs fsync also on the writeback target file, > > +# which is critical for trigerring the writeback failure. > > +shutdown_cmd=() > > +shutdown_handle="$(_scratch_shutdown_handle)" > > +if [ "$shutdown_handle" != "$SCRATCH_MNT" ];then > > + shutdown_cmd+=("-c" "open $shutdown_handle") > > +fi > > +shutdown_cmd+=("-c" "shutdown") > > IMO, this is unnecessary complexity. The original patch with the > "fsync acts on all open files" comment above explains the xfs_io > fsync quirk that enables the test to do what it is supposed to be > doing without any of the this conditional command construction. > > The less special case handling we need to splice into the test code, > the better. So you'd like to give below change a RVB? -$XFS_IO_PROG -x -c "mmap 0 4k" -c "mwrite 0 4k" -c shutdown -c fsync \ +$XFS_IO_PROG -x -c "mmap 0 4k" -c "mwrite 0 4k" \ + -c "open $(_scratch_shutdown_handle)" -c shutdown -c fsync \ I don't want complexity, just hope to keep the original testing logic. As I don't know if the current behavior of open_f and fsync_f is stable, it won't be changed in one day. Especially when I saw "open_f" says it "Closes the current file, and opens the file specified by path instead" but it doesn't. Now we depend on it opens a file as "current file", then shutdown will happen on this file, then fsync will sync all 2 opened files. That's the complexity for me. Thanks, Zorro > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-02 4:20 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-06-01 12:34 [PATCH v2] generic/623: fix test for runing on overlayfs Amir Goldstein 2022-06-01 23:44 ` Dave Chinner 2022-06-02 4:19 ` Zorro Lang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox