Re: [PATCH] btrfs/011: handle finished replace properly

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]





On 2022/1/10 21:54, Filipe Manana wrote:
[...]

Thus I want to end the whac-a-hole game once and for all, even it will
drop the coverage for super fast setup.

If everyone starts having a setup that is faster, then we will end up
not getting replace cancel covered in the long run,
and increasing the chances of finding out regressions only after
kernels are released, by users.

As I said earlier, I agree that the whac-a-mole style of change sent
by Josef is far from ideal, but at least it doesn't lose test
coverage.

It still doesn't solve the possible false alerts, it's doing masking,
just a different way.

But that masking will eventually hit ENOSPC and cause a different false
alerts.


If we have dedicated replace cancel tests, can we remove the false-alert
prone cancel test in btrfs/011?

In the end it's the same problem however, making sure that by the time
the cancel is requested, the replace operation is still in progress.

I don't see how making that in a separate test case will be more
reliable, unless you're considering something like dm delay (and in
that case why can't it be made in btrfs/011).

Isn't the same method of btrfs/212 more reliable?

Just run foreground replace in a loop, then another process to try to
cancel the replace.

Thanks,
Qu


Thanks.


Thanks,
Qu


Thanks.




Thanks,
Qu


Thanks.


One thing to notice is, since the replace finished, we need to replace
back the device, or later fsck will be executed on blank device, and
cause false alert.

Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
---
    tests/btrfs/011 | 15 +++++++++++++--
    1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index b4673341..aae89696 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -171,13 +171,24 @@ btrfs_replace_test()
               # background the replace operation (no '-B' option given)
               _run_btrfs_util_prog replace start -f $replace_options $source_dev $target_dev $SCRATCH_MNT
               sleep $wait_time
-            _run_btrfs_util_prog replace cancel $SCRATCH_MNT
+            $BTRFS_UTIL_PROG replace cancel $SCRATCH_MNT 2>&1 >> $seqres.full

               # 'replace status' waits for the replace operation to finish
               # before the status is printed
               $BTRFS_UTIL_PROG replace status $SCRATCH_MNT > $tmp.tmp 2>&1
               cat $tmp.tmp >> $seqres.full
-            grep -q canceled $tmp.tmp || _fail "btrfs replace status (canceled) failed"
+
+            # There is no guarantee we canceled the replace, it can finish
+            if grep -q 'finished' $tmp.tmp ; then
+                    # The replace finished, we need to replace it back or
+                    # later fsck will report error as $SCRATCH_DEV is now
+                    # blank
+                    $BTRFS_UTIL_PROG replace start -Bf $target_dev \
+                            $source_dev $SCRATCH_MNT > /dev/null
+            else
+                    grep -q 'canceled' $tmp.tmp || _fail \
+                            "btrfs replace status (canceled ) failed"
+            fi
       else
               if [ "${quick}Q" = "thoroughQ" ]; then
                       # The thorough test runs around 2 * $wait_time seconds.
--
2.34.1





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux