[PATCH v2] generic/623: fix test for runing on overlayfs

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

 



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@xxxxxxxxx>
---

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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux