All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v2] fstests: btrfs/143: make test case more reliable
Date: Wed, 15 Nov 2017 16:47:59 -0700	[thread overview]
Message-ID: <20171115234759.19168-1-bo.li.liu@oracle.com> (raw)
In-Reply-To: <20171023205733.14896-1-bo.li.liu@oracle.com>

This changes to use '_scratch_cycle_mount' to drop all caches btrfs could have
in order to avoid an issue that drop_caches somehow doesn't work on Nikolay's
box.

Also use bash -c to run 'read' only when %pid is odd so that we can read the
faulty disk.

Reported-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
v2: Change 'fadvise -d' to _scratch_cycle_mount.

To Nikolay,

I didn't add your tested-by, but could you please verify if this also
works on your test box?


 tests/btrfs/143 | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/btrfs/143 b/tests/btrfs/143
index da7bfd8..3875b6c 100755
--- a/tests/btrfs/143
+++ b/tests/btrfs/143
@@ -127,16 +127,16 @@ echo "step 3......repair the bad copy" >>$seqres.full
 # since raid1 consists of two copies, and the bad copy was put on stripe #1
 # while the good copy lies on stripe #0, the bad copy only gets access when the
 # reader's pid % 2 == 1 is true
-while true; do
-	# start_fail only fails the following buffered read so the repair is
-	# supposed to work.
-	echo 3 > /proc/sys/vm/drop_caches
-	start_fail
-	$XFS_IO_PROG -c "pread 0 4K" "$SCRATCH_MNT/foobar" > /dev/null &
-	pid=$!
-	wait
-	stop_fail
-	[ $((pid % 2)) == 1 ] && break
+while [[ -z ${result} ]]; do
+    # invalidate the page cache.
+    _scratch_cycle_mount
+
+    start_fail
+    result=$(bash -c "
+        if [[ \$((\$\$ % 2)) -eq 1 ]]; then
+                exec $XFS_IO_PROG -c \"pread 0 4K\" \"$SCRATCH_MNT/foobar\"
+        fi");
+    stop_fail
 done
 
 _scratch_unmount
-- 
2.5.0


  parent reply	other threads:[~2017-11-16  0:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 20:57 [PATCH] fstests: btrfs/143: make test case more reliable Liu Bo
2017-10-24  5:28 ` Nikolay Borisov
2017-10-24  8:51 ` Nikolay Borisov
2017-10-25 10:32 ` Nikolay Borisov
2017-11-15 23:47 ` Liu Bo [this message]
2017-11-16  8:59   ` [PATCH v2] " Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115234759.19168-1-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.