generic: test eofblocks race with file extending aio dio writes
PATCH 1/1 generic: test eofblocks race with file extending aio dio writes
It's possible for post-eof blocks to end up being used for direct I/O writes. dio write performs an upfront unwritten extent allocation, sends the dio and then updates the inode size (if necessary) on write completion. If a file release occurs while a file extending dio write is in flight, it is possible to mistake the post-eof blocks for speculative preallocation and incorrectly truncate them from the inode. This means that the resulting dio write completion can discover a hole and allocate new blocks rather than perform unwritten extent conversion.
A kernel warning can be reproduced by generic/299 on XFS:
XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, \
file: fs/xfs//xfs_trans.c, line: 309The root cause is that xfs_free_eofblocks() uses i_size to truncate post-eof blocks from the inode, but async, file extending direct writes do not update i_size until write completion, long after inode locks are dropped. Therefore, xfs_free_eofblocks() effectively truncates the inode to the incorrect size.
For cover this filesystem corruption testing, write this new case to check data integrality manually, not only depend on a kernel warning.
---
Hi,
This case is similar with generic/114 which use same aio-dio-eof-race.c program. I was planning to write an aio writer, but I found there's already a good program written by Eric, so I turn to use it directly :)
This case is different with g/114, this case runs aio-dio-eof-race with an "open & close" process together. This multi-processes maybe trigger a free_eofblocks race with file extending dio write.
Thanks,
Zorro
tests/generic/426 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.out
tests/generic/426 new file +87 -0
@@ -0,0 +1,87 @@ +#! /bin/bash +# FS QA Test 426 +# +# Try to trigger a race of free eofblocks and file extending dio writes. +# A known bug of XFS has been fixed by "e4229d6 xfs: fix eofblocks race +# with file extending async dio writes" +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch +_require_aiodio aio-dio-eof-race + +# limit the filesystem size, to save the time of filling filesystem +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mount + +# try to write more bytes than filesystem size to fill the filesystem +$XFS_IO_PROG -f -c "pwrite -S 0x55 0 $((1024 * 1024 * 1024 * 2))" \ + $SCRATCH_MNT/fillfs-$seq 2>/dev/null +rm -f $SCRATCH_MNT/fillfs-$seq + +# start a background aio writer, which does several extending loops +# internally and check data integrality +$AIO_TEST $SCRATCH_MNT/tst-aio-dio-eof-race.$seq & +aio_pid=$! + +# open & close the file frequently, to trigger xfs_free_eofblocks +while true; do + cat $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >/dev/null 2>&1 +done & +open_close_pid=$! + +wait $aio_pid +status=$? +kill $open_close_pid +wait $open_close_pid +if [ $status -ne 0 ]; then + od -t x1 $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >> $seqres.full + exit +fi + +# success, all done +status=0 +exit
tests/generic/426.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 426 +Success, all done.
tests/generic/group +1 -0
@@ -428,3 +428,4 @@ 423 auto quick 424 auto quick 425 auto quick attr +426 auto aio rw
Signature · 1 line
2.7.4
Quoted 9 lines · Zorro Lang
It's possible for post-eof blocks to end up being used for direct I/O writes. dio write performs an upfront unwritten extent allocation, sends the dio and then updates the inode size (if necessary) on write completion. If a file release occurs while a file extending dio write is in flight, it is possible to mistake the post-eof blocks for speculative preallocation and incorrectly truncate them from the inode. This means that the resulting dio write completion can discover a hole and allocate new blocks rather than perform unwritten extent conversion.
Quoted 4 lines
A kernel warning can be reproduced by generic/299 on XFS:
XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, \ file: fs/xfs//xfs_trans.c, line: 309
It might be important to point out that this test also exposes file corruption and/or stale data exposure. E.g., the verification of written data is an important distinction between this test and generic/299.
Quoted 9 lines
The root cause is that
xfs_free_eofblocks()usesi_sizeto truncate post-eof blocks from the inode, but async, file extending direct writes do not updatei_sizeuntil write completion, long after inode locks are dropped. Therefore,xfs_free_eofblocks()effectively truncates the inode to the incorrect size.For cover this filesystem corruption testing, write this new case to check data integrality manually, not only depend on a kernel warning.
Quoted 9 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This case is similar with generic/114 which use same
aio-dio-eof-race.cprogram. I was planning to write an aio writer, but I found there's already a good program written by Eric, so I turn to use it directly :)
Well, that is convenient. ;) A few quick notes...
Quoted 66 lines
This case is different with g/114, this case runs aio-dio-eof-race with an "open & close" process together. This multi-processes maybe trigger a
free_eofblocksrace with file extending dio write.Thanks,
Zorrotests/generic/426 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.outtests/generic/426 new file +45
-0@@ -0,0 +1,87 @@ +#! /bin/bash +# FS QA Test 426 +# +# Try to trigger a race of free eofblocks and file extending dio writes. +# A known bug of XFS has been fixed by "e4229d6 xfs: fix eofblocks race +# with file extending async dio writes" +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test
tests/generic/426 line 55
Quoted 10 lines
tests/generic/426 new file +10
-0+rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch +_require_aiodio aio-dio-eof-race +
It looks like this tool doesn't do a ton of writing... up to 8MB. Has that proven to be a reliable reproducer in your testing so far? I'm kind of wondering if we should update that tool with a flag to accept a configurable file size, but that's not a big deal if the reproducer is reliable.
tests/generic/426 line 59
Quoted 4 lines
tests/generic/426 new file +4
-0+# limit the filesystem size, to save the time of filling filesystem +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mount +
That's 1G... I wonder if we can get away with smaller (a couple hundred MB perhaps?), since we have to fill the whole thing first.
Quoted 6 lines
tests/generic/426 new file +6
-0+# try to write more bytes than filesystem size to fill the filesystem +$XFS_IO_PROG -f -c "pwrite -S 0x55 0 $((1024 * 1024 * 1024 * 2))" \ + $SCRATCH_MNT/fillfs-$seq 2>/dev/null +rm -f $SCRATCH_MNT/fillfs-$seq + +# start a background aio writer, which does several extending loops
tests/generic/426 line 75
Quoted 10 lines
tests/generic/426 new file +10
-0+# internally and check data integrality +$AIO_TEST $SCRATCH_MNT/tst-aio-dio-eof-race.$seq & +aio_pid=$! + +# open & close the file frequently, to trigger xfs_free_eofblocks +while true; do + cat $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >/dev/null 2>&1 +done & +open_close_pid=$! +
We probably want to start the open/close loop before the writer to reduce the chances of the writer doing much work before the open/close loop actually starts.
I also wonder if something like the following would be better than using cat:
while true; do
exec 3<>$SCRATCH_MNT/tst-aio-dio-eof-race.$seq exec 3<>-
done
... because we can skip useless reads of the file. Something like '$XFS_IO -c open <file>' may be another option as well.
Brian
Quoted 36 lines
tests/generic/426 new file +12
-0+wait $aio_pid +status=$? +kill $open_close_pid +wait $open_close_pid +if [ $status -ne 0 ]; then + od -t x1 $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >> $seqres.full + exit +fi + +# success, all done +status=0 +exittests/generic/426.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 426 +Success, all done.tests/generic/group +1
-0@@ -428,3 +428,4 @@ 423 auto quick 424 auto quick 425 auto quick attr +426 auto aio rwSignature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Brian Foster
Quoted 9 lines · Zorro Lang
It's possible for post-eof blocks to end up being used for direct I/O writes. dio write performs an upfront unwritten extent allocation, sends the dio and then updates the inode size (if necessary) on write completion. If a file release occurs while a file extending dio write is in flight, it is possible to mistake the post-eof blocks for speculative preallocation and incorrectly truncate them from the inode. This means that the resulting dio write completion can discover a hole and allocate new blocks rather than perform unwritten extent conversion.
Quoted 8 lines
Quoted 4 lines
A kernel warning can be reproduced by generic/299 on XFS:
XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, \ file: fs/xfs//xfs_trans.c, line: 309It might be important to point out that this test also exposes file corruption and/or stale data exposure. E.g., the verification of written data is an important distinction between this test and generic/299.
Sure, I'll add that. Hah, Sorry I pasted your commit log at here directly :)
Quoted 13 lines
Quoted 13 lines
The root cause is that
xfs_free_eofblocks()usesi_sizeto truncate post-eof blocks from the inode, but async, file extending direct writes do not updatei_sizeuntil write completion, long after inode locks are dropped. Therefore,xfs_free_eofblocks()effectively truncates the inode to the incorrect size.For cover this filesystem corruption testing, write this new case to check data integrality manually, not only depend on a kernel warning.
Signed-off-by Zorro Lang <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Hi,
This case is similar with generic/114 which use same
aio-dio-eof-race.cprogram. I was planning to write an aio writer, but I found there's already a good program written by Eric, so I turn to use it directly :)Well, that is convenient. ;) A few quick notes...
Yeah, but I've written one, then I found this one T_T..
Quoted 75 lines
Quoted 75 lines
This case is different with g/114, this case runs aio-dio-eof-race with an "open & close" process together. This multi-processes maybe trigger a
free_eofblocksrace with file extending dio write.Thanks,
Zorrotests/generic/426 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.outtests/generic/426 new file +53
-0@@ -0,0 +1,87 @@ +#! /bin/bash +# FS QA Test 426 +# +# Try to trigger a race of free eofblocks and file extending dio writes. +# A known bug of XFS has been fixed by "e4229d6 xfs: fix eofblocks race +# with file extending async dio writes" +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch
Quoted 8 lines
tests/generic/426 line 55
Quoted 2 lines
tests/generic/426 new file +2
-0+_require_aiodio aio-dio-eof-race +It looks like this tool doesn't do a ton of writing... up to 8MB. Has that proven to be a reliable reproducer in your testing so far? I'm kind of wondering if we should update that tool with a flag to accept a configurable file size, but that's not a big deal if the reproducer is reliable.
Yes, compare with the original reproducer of this bug, aio-dio-eof-race do leass writing. For reproduce this bug, I increase the frequence of open & close (no sleep 1), then the bug still can be reproduced as my testing with very high reproducible.
I was thinking if I should change aio-dio-eof-race.c, because I don't know if it always can be 100% reproduced on high performance machine.
Quoted 8 lines
tests/generic/426 line 59
Quoted 5 lines
tests/generic/426 new file +4
-0+# limit the filesystem size, to save the time of filling filesystem +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mount +That's 1G... I wonder if we can get away with smaller (a couple hundred MB perhaps?), since we have to fill the whole thing first.
Sure, how about 512MB or 256MB? What's the minimum hint size of XFS?
Quoted 25 lines
Quoted 7 lines
tests/generic/426 new file +6
-0+# try to write more bytes than filesystem size to fill the filesystem +$XFS_IO_PROG -f -c "pwrite -S 0x55 0 $((1024 * 1024 * 1024 * 2))" \ + $SCRATCH_MNT/fillfs-$seq 2>/dev/null +rm -f $SCRATCH_MNT/fillfs-$seq + +# start a background aio writer, which does several extending loopstests/generic/426 line 75
Quoted 10 lines
tests/generic/426 new file +10
-0+# internally and check data integrality +$AIO_TEST $SCRATCH_MNT/tst-aio-dio-eof-race.$seq & +aio_pid=$! + +# open & close the file frequently, to trigger xfs_free_eofblocks +while true; do + cat $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >/dev/null 2>&1 +done & +open_close_pid=$! +We probably want to start the open/close loop before the writer to reduce the chances of the writer doing much work before the open/close loop actually starts.
I also wonder if something like the following would be better than using cat:
Quoted 7 lines
while true; do
exec 3<>$SCRATCH_MNT/tst-aio-dio-eof-race.$seq exec 3<>-done
... because we can skip useless reads of the file. Something like '$XFS_IO -c open <file>' may be another option as well.
Sure, that's better !
Quoted 43 lines
Brian
Quoted 36 lines
tests/generic/426 new file +12
-0+wait $aio_pid +status=$? +kill $open_close_pid +wait $open_close_pid +if [ $status -ne 0 ]; then + od -t x1 $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >> $seqres.full + exit +fi + +# success, all done +status=0 +exittests/generic/426.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 426 +Success, all done.tests/generic/group +1
-0@@ -428,3 +428,4 @@ 423 auto quick 424 auto quick 425 auto quick attr +426 auto aio rwSignature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 130 lines · Zorro Lang
Quoted 10 lines · Brian Foster
Quoted 9 lines · Zorro Lang
It's possible for post-eof blocks to end up being used for direct I/O writes. dio write performs an upfront unwritten extent allocation, sends the dio and then updates the inode size (if necessary) on write completion. If a file release occurs while a file extending dio write is in flight, it is possible to mistake the post-eof blocks for speculative preallocation and incorrectly truncate them from the inode. This means that the resulting dio write completion can discover a hole and allocate new blocks rather than perform unwritten extent conversion.
Quoted 8 lines
Quoted 4 lines
A kernel warning can be reproduced by generic/299 on XFS:
XFS: Assertion failed: tp->t_blk_res_used <= tp->t_blk_res, \ file: fs/xfs//xfs_trans.c, line: 309It might be important to point out that this test also exposes file corruption and/or stale data exposure. E.g., the verification of written data is an important distinction between this test and generic/299.
Sure, I'll add that. Hah, Sorry I pasted your commit log at here directly :)
Quoted 13 lines
Quoted 13 lines
The root cause is that
xfs_free_eofblocks()usesi_sizeto truncate post-eof blocks from the inode, but async, file extending direct writes do not updatei_sizeuntil write completion, long after inode locks are dropped. Therefore,xfs_free_eofblocks()effectively truncates the inode to the incorrect size.For cover this filesystem corruption testing, write this new case to check data integrality manually, not only depend on a kernel warning.
Signed-off-by Zorro Lang <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Hi,
This case is similar with generic/114 which use same
aio-dio-eof-race.cprogram. I was planning to write an aio writer, but I found there's already a good program written by Eric, so I turn to use it directly :)Well, that is convenient. ;) A few quick notes...
Yeah, but I've written one, then I found this one
T_T..Quoted 75 lines
Quoted 75 lines
This case is different with g/114, this case runs aio-dio-eof-race with an "open & close" process together. This multi-processes maybe trigger a
free_eofblocksrace with file extending dio write.Thanks,
Zorrotests/generic/426 | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/426.out | 2 ++ tests/generic/group | 1 + 3 files changed, 90 insertions(+) create mode 100755 tests/generic/426 create mode 100644 tests/generic/426.outtests/generic/426 new file +53
-0@@ -0,0 +1,87 @@ +#! /bin/bash +# FS QA Test 426 +# +# Try to trigger a race of free eofblocks and file extending dio writes. +# A known bug of XFS has been fixed by "e4229d6 xfs: fix eofblocks race +# with file extending async dio writes" +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratchQuoted 8 lines
tests/generic/426 line 55
Quoted 2 lines
tests/generic/426 new file +2
-0+_require_aiodio aio-dio-eof-race +It looks like this tool doesn't do a ton of writing... up to 8MB. Has that proven to be a reliable reproducer in your testing so far? I'm kind of wondering if we should update that tool with a flag to accept a configurable file size, but that's not a big deal if the reproducer is reliable.
Quoted 8 lines
Yes, compare with the original reproducer of this bug, aio-dio-eof-race do leass writing. For reproduce this bug, I increase the frequence of open & close (no sleep 1), then the bug still can be reproduced as my testing with very high reproducible.
I was thinking if I should change
aio-dio-eof-race.c, because I don't know if it always can be 100% reproduced on high performance machine.
Ok, well it may be worth a try on a different environment, though I would expect it to still work.
Quoted 11 lines
Quoted 8 lines
tests/generic/426 line 59
Quoted 5 lines
tests/generic/426 new file +4
-0+# limit the filesystem size, to save the time of filling filesystem +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >>$seqres.full 2>&1 +_scratch_mount +That's 1G... I wonder if we can get away with smaller (a couple hundred MB perhaps?), since we have to fill the whole thing first.
Sure, how about 512MB or 256MB? What's the minimum hint size of XFS?
IMO, the smallest you can possibly use, the better. I'm not sure we have a specific min size, it may depend on what mkfs options are provided. 256MB sounds more reasonable to me...? This is something that is probably going to run during every auto xfstests run, so the less time spent doing unnecessary test preparation like stamping unused fs blocks with a pattern, the easier it is to keep the overall runtime down.
Brian
Quoted 82 lines
Quoted 25 lines
Quoted 7 lines
tests/generic/426 new file +6
-0+# try to write more bytes than filesystem size to fill the filesystem +$XFS_IO_PROG -f -c "pwrite -S 0x55 0 $((1024 * 1024 * 1024 * 2))" \ + $SCRATCH_MNT/fillfs-$seq 2>/dev/null +rm -f $SCRATCH_MNT/fillfs-$seq + +# start a background aio writer, which does several extending loopstests/generic/426 line 75
Quoted 10 lines
tests/generic/426 new file +10
-0+# internally and check data integrality +$AIO_TEST $SCRATCH_MNT/tst-aio-dio-eof-race.$seq & +aio_pid=$! + +# open & close the file frequently, to trigger xfs_free_eofblocks +while true; do + cat $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >/dev/null 2>&1 +done & +open_close_pid=$! +We probably want to start the open/close loop before the writer to reduce the chances of the writer doing much work before the open/close loop actually starts.
I also wonder if something like the following would be better than using cat:
Quoted 7 lines
while true; do
exec 3<>$SCRATCH_MNT/tst-aio-dio-eof-race.$seq exec 3<>-done
... because we can skip useless reads of the file. Something like '$XFS_IO -c open <file>' may be another option as well.
Sure, that's better !
Quoted 35 lines
Brian
Quoted 32 lines
tests/generic/426 new file +12
-0+wait $aio_pid +status=$? +kill $open_close_pid +wait $open_close_pid +if [ $status -ne 0 ]; then + od -t x1 $SCRATCH_MNT/tst-aio-dio-eof-race.$seq >> $seqres.full + exit +fi + +# success, all done +status=0 +exittests/generic/426.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 426 +Success, all done.tests/generic/group +1
-0@@ -428,3 +428,4 @@ 423 auto quick 424 auto quick 425 auto quick attr +426 auto aio rwSignature · 1 line
2.7.4Quoted 8 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html