All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/544: Fix inode number ordering code
@ 2021-11-13 21:00 Kent Overstreet
  2021-11-15 17:41 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Kent Overstreet @ 2021-11-13 21:00 UTC (permalink / raw)
  To: fstests

The code that creates files and moves them to low/high inode number
files writes different file contents before doing the move - leading to
non-reproducible results.

Fix this by writing the file contents after moving them to high/low
inode number files.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/544 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/generic/544 b/tests/generic/544
index 4a9f48526d..4dbaea4de0 100755
--- a/tests/generic/544
+++ b/tests/generic/544
@@ -44,8 +44,9 @@ inum() {
 # Create two test files, make $low_file the file with the lower inode
 # number, and make $high_file the file with the higher inode number.
 create_files() {
-	_pwrite_byte 0x60 0 $filesize $testdir/file1 >> $seqres.full
-	_pwrite_byte 0x61 0 $filesize $testdir/file2 >> $seqres.full
+	touch $testdir/file1
+	touch $testdir/file2
+
 	if [ "$(inum $testdir/file1)" -lt "$(inum $testdir/file2)" ]; then
 		mv $testdir/file1 $low_file
 		mv $testdir/file2 $high_file
@@ -53,6 +54,9 @@ create_files() {
 		mv $testdir/file2 $low_file
 		mv $testdir/file1 $high_file
 	fi
+
+	_pwrite_byte 0x60 0 $filesize $low_file >> $seqres.full
+	_pwrite_byte 0x61 0 $filesize $high_file >> $seqres.full
 }
 
 # Check md5sum of both files, but keep results sorted by inode order
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] generic/544: Fix inode number ordering code
  2021-11-13 21:00 [PATCH] generic/544: Fix inode number ordering code Kent Overstreet
@ 2021-11-15 17:41 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2021-11-15 17:41 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: fstests

On Sat, Nov 13, 2021 at 04:00:03PM -0500, Kent Overstreet wrote:
> The code that creates files and moves them to low/high inode number
> files writes different file contents before doing the move - leading to
> non-reproducible results.
> 
> Fix this by writing the file contents after moving them to high/low
> inode number files.
> 
> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>

DOH.  Yep, this is correct.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/generic/544 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/544 b/tests/generic/544
> index 4a9f48526d..4dbaea4de0 100755
> --- a/tests/generic/544
> +++ b/tests/generic/544
> @@ -44,8 +44,9 @@ inum() {
>  # Create two test files, make $low_file the file with the lower inode
>  # number, and make $high_file the file with the higher inode number.
>  create_files() {
> -	_pwrite_byte 0x60 0 $filesize $testdir/file1 >> $seqres.full
> -	_pwrite_byte 0x61 0 $filesize $testdir/file2 >> $seqres.full
> +	touch $testdir/file1
> +	touch $testdir/file2
> +
>  	if [ "$(inum $testdir/file1)" -lt "$(inum $testdir/file2)" ]; then
>  		mv $testdir/file1 $low_file
>  		mv $testdir/file2 $high_file
> @@ -53,6 +54,9 @@ create_files() {
>  		mv $testdir/file2 $low_file
>  		mv $testdir/file1 $high_file
>  	fi
> +
> +	_pwrite_byte 0x60 0 $filesize $low_file >> $seqres.full
> +	_pwrite_byte 0x61 0 $filesize $high_file >> $seqres.full
>  }
>  
>  # Check md5sum of both files, but keep results sorted by inode order
> -- 
> 2.33.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-16  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 21:00 [PATCH] generic/544: Fix inode number ordering code Kent Overstreet
2021-11-15 17:41 ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.