Skip to contentSkip to conversation

Ensure _scratch_fuzz_modify() works for other filesystems

PATCH Superseded Luis Henriques (SUSE) 2 participants 7 messages Mar 14, 2024 – Mar 15, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Ensure _scratch_fuzz_modify() works for other filesystems

Hi!

I guess test ext4/006 isn't executed very often, because as far as I can see it has been broken for quite some time. The problem is that the function _scratch_fuzz_modify() is executing xfs-specific operations that will make this test fail.

The first patch updates this function so that xfs-specific operations are executed only when that filesystem is being tested.

The second patch simply updates the test to take into account the new output of the function (and yeah, counting log lines is an ugly hack).

Luis Henriques (SUSE) (2):
common/fuzzy: make _scratch_fuzz_modify work for non-xfs filesystems ext4/006: take into account updates to _scratch_fuzz_modify()

 common/fuzzy   | 16 +++++++++-------
 tests/ext4/006 |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/2 common/fuzzy: make _scratch_fuzz_modify work for non-xfs filesystems

Since commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little harder after repairing") funtion _scratch_fuzz_modify() has become xfs-specific due to the use of some functions that assume this filesytem, namely _xfs_force_bdev() and _xfs_has_feature().

Ensure _scratch_fuzz_modify() works again with other filesystems by using these functions only when testing xfs.

---
 common/fuzzy | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
common/fuzzy +9 -7
index f5d45cb28f07..218fe1654386 100644
@@ -8,15 +8,17 @@
 _scratch_fuzz_modify() {
 	echo "+++ stressing filesystem"
 	mkdir -p $SCRATCH_MNT/data
-	_xfs_force_bdev data $SCRATCH_MNT/data
+	[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
 	$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data
 
-	if _xfs_has_feature "$SCRATCH_MNT" realtime; then
-		mkdir -p $SCRATCH_MNT/rt
-		_xfs_force_bdev realtime $SCRATCH_MNT/rt
-		$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
-	else
-		echo "+++ xfs realtime not configured"
+	if [ "$FSTYP" = "xfs" ]; then
+		if _xfs_has_feature "$SCRATCH_MNT" realtime; then
+			mkdir -p $SCRATCH_MNT/rt
+			_xfs_force_bdev realtime $SCRATCH_MNT/rt
+			$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
+		else
+			echo "+++ xfs realtime not configured"
+		fi
 	fi
 }
 
#3 lore raw

PATCH 2/2 ext4/006: take into account updates to _scratch_fuzz_modify()

In reply to Luis Henriques (SUSE)

Since function _scratch_fuzz_modify() has been updated, its output has changed. Modify test ext4/006 to take this change into account.

---
 tests/ext4/006 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/ext4/006 +1 -1
index 8792167bd9c2..b73692aa5b81 100755
@@ -131,7 +131,7 @@ echo "++ check fs (2)" >> $seqres.full
 _check_scratch_fs >> $seqres.full 2>&1
 
 grep -E -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
-if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
 	echo "e2fsck did not fix everything" | tee -a $seqres.full
 fi
 echo "finished fuzzing" | tee -a "$seqres.full"
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] common/fuzzy: make _scratch_fuzz_modify work for non-xfs filesystems

In reply to Luis Henriques (SUSE)
Quoted 9 lines · Luis Henriques (SUSE)

Since commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little harder after repairing") funtion _scratch_fuzz_modify() has become xfs-specific due to the use of some functions that assume this filesytem, namely _xfs_force_bdev() and _xfs_has_feature().

Ensure _scratch_fuzz_modify() works again with other filesystems by using these functions only when testing xfs.

Oooooops sorry about that. :(

--D

Quoted 34 lines
---
 common/fuzzy | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
common/fuzzy +9 -7
index f5d45cb28f07..218fe1654386 100644
@@ -8,15 +8,17 @@
 _scratch_fuzz_modify() {
 	echo "+++ stressing filesystem"
 	mkdir -p $SCRATCH_MNT/data
-	_xfs_force_bdev data $SCRATCH_MNT/data
+	[ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
 	$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data
 
-	if _xfs_has_feature "$SCRATCH_MNT" realtime; then
-		mkdir -p $SCRATCH_MNT/rt
-		_xfs_force_bdev realtime $SCRATCH_MNT/rt
-		$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
-	else
-		echo "+++ xfs realtime not configured"
+	if [ "$FSTYP" = "xfs" ]; then
+		if _xfs_has_feature "$SCRATCH_MNT" realtime; then
+			mkdir -p $SCRATCH_MNT/rt
+			_xfs_force_bdev realtime $SCRATCH_MNT/rt
+			$FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
+		else
+			echo "+++ xfs realtime not configured"
+		fi
 	fi
 }
 
#4 lore raw

Re: [PATCH 2/2] ext4/006: take into account updates to _scratch_fuzz_modify()

In reply to Luis Henriques (SUSE)
Quoted 2 lines · Luis Henriques (SUSE)

Since function _scratch_fuzz_modify() has been updated, its output has changed. Modify test ext4/006 to take this change into account.

Now that you've blocked off the XFS stuff, what line changed?

--D

Quoted 19 lines
---
 tests/ext4/006 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/ext4/006 +1 -1
index 8792167bd9c2..b73692aa5b81 100755
@@ -131,7 +131,7 @@ echo "++ check fs (2)" >> $seqres.full
 _check_scratch_fs >> $seqres.full 2>&1
 
 grep -E -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
-if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
 	echo "e2fsck did not fix everything" | tee -a $seqres.full
 fi
 echo "finished fuzzing" | tee -a "$seqres.full"
#5 lore raw

Re: [PATCH 2/2] ext4/006: take into account updates to _scratch_fuzz_modify()

Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Luis Henriques (SUSE)

Since function _scratch_fuzz_modify() has been updated, its output has changed. Modify test ext4/006 to take this change into account.

Now that you've blocked off the XFS stuff, what line changed?

Well, there are three lines that are gone with commit 9bab148bb3c7:

echo "+++ touch ${nr} files"
echo "+++ create files"
echo "+++ remove files"

And a new one was added:

echo "+++ stressing filesystem"

However, running fsstress will also add a new line with:

	printf("seed = %ld\n", seed);

So the delta is one line (seven instead of eight).

Cheers,

Signature · 1 line
Luís
Quoted 22 lines

--D

Quoted 19 lines
---
 tests/ext4/006 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/ext4/006 +1 -1
index 8792167bd9c2..b73692aa5b81 100755
@@ -131,7 +131,7 @@ echo "++ check fs (2)" >> $seqres.full
 _check_scratch_fs >> $seqres.full 2>&1
 
 grep -E -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
-if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
 	echo "e2fsck did not fix everything" | tee -a $seqres.full
 fi
 echo "finished fuzzing" | tee -a "$seqres.full"
Reviewed-by
#6 lore raw

Re: [PATCH 2/2] ext4/006: take into account updates to _scratch_fuzz_modify()

Quoted 16 lines · Luis Henriques
Quoted 5 lines · Darrick J. Wong
Quoted 2 lines · Luis Henriques (SUSE)

Since function _scratch_fuzz_modify() has been updated, its output has changed. Modify test ext4/006 to take this change into account.

Now that you've blocked off the XFS stuff, what line changed?

Well, there are three lines that are gone with commit 9bab148bb3c7:

echo "+++ touch ${nr} files"
echo "+++ create files"
echo "+++ remove files"

And a new one was added:

Quoted 7 lines

echo "+++ stressing filesystem"

However, running fsstress will also add a new line with:

	printf("seed = %ld\n", seed);

So the delta is one line (seven instead of eight).

Ah, ok. Can you copy-paste that into the commit message so that we have some record of what caused the need for the adjustment, please?

With that added,

--D

Quoted 27 lines

Cheers,

Signature · 1 line
Luís
Quoted 22 lines

--D

Quoted 19 lines
---
 tests/ext4/006 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/ext4/006 +1 -1
index 8792167bd9c2..b73692aa5b81 100755
@@ -131,7 +131,7 @@ echo "++ check fs (2)" >> $seqres.full
 _check_scratch_fs >> $seqres.full 2>&1
 
 grep -E -q '(did not fix|makes no progress)' $seqres.full && echo "e2fsck failed" | tee -a $seqres.full
-if [ "$(wc -l < "$ROUND2_LOG")" -ne 8 ]; then
+if [ "$(wc -l < "$ROUND2_LOG")" -ne 7 ]; then
 	echo "e2fsck did not fix everything" | tee -a $seqres.full
 fi
 echo "finished fuzzing" | tee -a "$seqres.full"