Skip to contentSkip to conversation

Ensure _scratch_fuzz_modify() works for other filesystems

PATCH In review Luis Henriques (SUSE) 2 participants 5 messages Mar 15, 2024 – Mar 20, 2024

lore
Share & tools
lore
#0 lore raw

v2 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).

Changes since v1:
* Updated the second patch commit message to add further details on what changed with the test output.

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 v2 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 v2 2/2 ext4/006: take into account updates to _scratch_fuzz_modify()

In reply to Luis Henriques (SUSE)

Test ext4/006 takes into account the number of lines produced by its own output. However, changes introduced to function _scratch_fuzz_modify() by commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little harder after repairing"), modified the output. Namely, the following three lines were removed:

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

And a new one was added:

echo "+++ stressing filesystem"

However, the usage of 'fsstress' also added an extra line with:

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

So the delta is one line (-3 + 2).

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 v2 1/2
#2 lore raw

Re: [PATCH v2 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.

Still looks ok,

--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
 }
 
Reviewed-by on v2 2/2
#4 lore raw

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

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

Test ext4/006 takes into account the number of lines produced by its own output. However, changes introduced to function _scratch_fuzz_modify() by commit 9bab148bb3c7 ("common/fuzzy: exercise the filesystem a little harder after repairing"), modified the output. Namely, the following three lines were removed:

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

And a new one was added:

echo "+++ stressing filesystem"

However, the usage of 'fsstress' also added an extra line with:

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

So the delta is one line (-3 + 2).

Modify test ext4/006 to take this change into account.

Thanks for updating the commit message,

--D

Quoted 18 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"