Skip to contentSkip to conversation

xfs/432: fix this test when external devices are in use

PATCH Superseded Darrick J. Wong 3 participants 8 messages Jul 26, 2022 – Jul 27, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs/432: fix this test when external devices are in use

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +10 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"
 
 # success, all done
 status=0
#1 lore raw
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 10 lines
tests/xfs/432 +10 -0
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

Make sense to me, I don't have better idea. One question, is xfs_metadump and xfs_mdrestore support rtdev? Due to I didn't find xfs_metadump have a "-r" option, although it has "-l logdev" :)

About the "$res", I don't know why we need this extra variable, as it's not used in other place.

Thanks,
Zorro

Quoted 4 lines
tests/xfs/432 +0 -0
 # success, all done
 status=0
 
#2 lore raw
Quoted 21 lines · Zorro Lang
Quoted 20 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -0
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
Quoted 16 lines

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 12 lines
tests/xfs/432 +10 -1
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

Make sense to me, I don't have better idea. One question, is xfs_metadump and xfs_mdrestore support rtdev? Due to I didn't find xfs_metadump have a "-r" option, although it has "-l logdev" :)

Oops, no it doesn't, so I'll remove that.

Quoted 2 lines

About the "$res", I don't know why we need this extra variable, as it's not used in other place.

If you don't pass the correct arguments to xfs_repair or the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.

--D

Quoted 8 lines

Thanks,
Zorro

Quoted 4 lines
tests/xfs/432 +0 -0
 # success, all done
 status=0
 
#3 lore raw
Quoted 39 lines · Darrick J. Wong
Quoted 21 lines · Zorro Lang
Quoted 20 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -0
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
Quoted 16 lines

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 12 lines
tests/xfs/432 +10 -1
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

Make sense to me, I don't have better idea. One question, is xfs_metadump and xfs_mdrestore support rtdev? Due to I didn't find xfs_metadump have a "-r" option, although it has "-l logdev" :)

Quoted 1 line

Oops, no it doesn't, so I'll remove that.

Hmm... it doesn't for now or won't for future?

So all test cases about xfs_metadump can't run with SCRATCH_RTDEV? Do we need something likes _require_nortdev?

Quoted 8 lines
Quoted 3 lines

About the "$res", I don't know why we need this extra variable, as it's not used in other place.

If you don't pass the correct arguments to xfs_repair or the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.

Oh, I mean why not use the "$?" directly? Or :
$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 || \
echo "xfs_repair on restored fs returned $res?"

Looks like we don't need to save this return status and use it on other place. The "$res" looks redundant, although it's not wrong :)

Thanks,
Zorro

Quoted 12 lines

--D

Quoted 8 lines

Thanks,
Zorro

Quoted 4 lines
tests/xfs/432 +0 -0
 # success, all done
 status=0
 
#4 lore raw

Re: [PATCH] xfs/432: fix this test when external devices are in useOM

Quoted 40 lines · Zorro Lang
Quoted 39 lines · Darrick J. Wong
Quoted 37 lines · Zorro Lang
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 10 lines
tests/xfs/432 +10 -0
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

Make sense to me, I don't have better idea. One question, is xfs_metadump and xfs_mdrestore support rtdev? Due to I didn't find xfs_metadump have a "-r" option, although it has "-l logdev" :)

Quoted 6 lines
Quoted 1 line

Oops, no it doesn't, so I'll remove that.

Hmm... it doesn't for now or won't for future?

So all test cases about xfs_metadump can't run with SCRATCH_RTDEV? Do we need something likes _require_nortdev?

There's no need for metadump to touch the realtime device since it contains only file data.

Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

About the "$res", I don't know why we need this extra variable, as it's not used in other place.

If you don't pass the correct arguments to xfs_repair or the metadump trashes the fs, it'll exit with a nonzero code. All the output goes to $seqres.full, which means the test runner has no idea anything went wrong and marks the test passed even though repair failed.

Quoted 6 lines

Oh, I mean why not use the "$?" directly? Or :
$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1 || \
echo "xfs_repair on restored fs returned $res?"

Looks like we don't need to save this return status and use it on other place. The "$res" looks redundant, although it's not wrong :)

Oh, yeah, I can do that too.

--D

Quoted 16 lines

Thanks,
Zorro

Quoted 12 lines

--D

Quoted 8 lines

Thanks,
Zorro

Quoted 4 lines
tests/xfs/432 +0 -0
 # success, all done
 status=0
 
#5 lore raw
In reply to Darrick J. Wong
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 10 lines
tests/xfs/432 +10 -0
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

I don't like open coding external device support into individual tests.

i.e. Shouldn't this use a wrapper around check_xfs_filesystem() similar to _check_xfs_test_fs()? Call it check_xfs_scratch_fs() that uses SCRATCH_DEV by default, but if $1 is passed in use that as the scratch device instead?

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#6 lore raw
Quoted 37 lines · Dave Chinner
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 10 lines
tests/xfs/432 +10 -0
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

I don't like open coding external device support into individual tests.

Quoted 4 lines

i.e. Shouldn't this use a wrapper around check_xfs_filesystem() similar to _check_xfs_test_fs()? Call it check_xfs_scratch_fs() that uses SCRATCH_DEV by default, but if $1 is passed in use that as the scratch device instead?

Yeah, that would also work. IIRC there's one other fstest that does something similar to this.

--D

Quoted 6 lines

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#7 lore raw
Quoted 38 lines · Darrick J. Wong
Quoted 37 lines · Dave Chinner
Quoted 22 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This program exercises metadump and mdrestore being run against the scratch device. Therefore, the test must pass external log / rt device arguments to xfs_repair -n to check the "restored" filesystem. Fix the incorrect usage, and report repair failures, since this test has been silently failing for a while now.

---
 tests/xfs/432 |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/xfs/432 +0 -1
index 86012f0b..5c6744ce 100755
@@ -89,7 +89,16 @@ _scratch_xfs_metadump $metadump_file -w
 xfs_mdrestore $metadump_file $metadump_img
 
 echo "Check restored metadump image"
-$XFS_REPAIR_PROG -n $metadump_img >> $seqres.full 2>&1

tests/xfs/432 _scratch_xfs_metadump $metadump_file -w · line 101

Quoted 10 lines
tests/xfs/432 +10 -0
+repair_args=('-n')
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	repair_args+=('-l' "$SCRATCH_LOGDEV")
+
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	repair_args+=('-r' "$SCRATCH_RTDEV")
+
+$XFS_REPAIR_PROG "${repair_args[@]}" $metadump_img >> $seqres.full 2>&1
+res=$?
+test $res -ne 0 && echo "xfs_repair on restored fs returned $res?"

I don't like open coding external device support into individual tests.

Quoted 7 lines
Quoted 4 lines

i.e. Shouldn't this use a wrapper around check_xfs_filesystem() similar to _check_xfs_test_fs()? Call it check_xfs_scratch_fs() that uses SCRATCH_DEV by default, but if $1 is passed in use that as the scratch device instead?

Yeah, that would also work. IIRC there's one other fstest that does something similar to this.

Actually, there already is a _scratch_xfs_repair, so I think I'll just re(ab)use it:

SCRATCH_DEV=$metadump_img _scratch_xfs_repair -n &>> $seqres.full || \
echo "xfs_repair on restored fs returned $?"

--D

Quoted 8 lines

--D

Quoted 6 lines

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]