linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs/271: include common/fail_make_request
@ 2022-08-23 19:32 Christoph Hellwig
  2022-08-23 19:32 ` [PATCH 2/2] btrfs/271: use the common fail_request setup helpers Christoph Hellwig
  2022-08-24 15:06 ` [PATCH 1/2] btrfs/271: include common/fail_make_request Darrick J. Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-08-23 19:32 UTC (permalink / raw)
  To: linux-btrfs, fstests

This tests needs the _require_fail_make_request helper from
common/fail_make_request, so include that file to avoid a test failure.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/btrfs/271 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/btrfs/271 b/tests/btrfs/271
index c21858d1..681fa965 100755
--- a/tests/btrfs/271
+++ b/tests/btrfs/271
@@ -10,6 +10,7 @@
 _begin_fstest auto quick raid
 
 . ./common/filter
+. ./common/fail_make_request
 
 _supported_fs btrfs
 _require_scratch
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] btrfs/271: use the common fail_request setup helpers
  2022-08-23 19:32 [PATCH 1/2] btrfs/271: include common/fail_make_request Christoph Hellwig
@ 2022-08-23 19:32 ` Christoph Hellwig
  2022-08-24 15:06   ` Darrick J. Wong
  2022-08-24 15:06 ` [PATCH 1/2] btrfs/271: include common/fail_make_request Darrick J. Wong
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-08-23 19:32 UTC (permalink / raw)
  To: linux-btrfs, fstests

Use the helpers from common/fail_make_request instead of open coding
them.  This switches to using a higher error count than the existing
code, which was the intention from the very beginning (and doesn't
actuallt matter for the short sequences in this test).

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 tests/btrfs/271     | 35 ++++++++---------------------------
 tests/btrfs/271.out |  2 ++
 2 files changed, 10 insertions(+), 27 deletions(-)

diff --git a/tests/btrfs/271 b/tests/btrfs/271
index 681fa965..c7c95b3e 100755
--- a/tests/btrfs/271
+++ b/tests/btrfs/271
@@ -18,20 +18,6 @@ _require_fail_make_request
 _require_scratch_dev_pool 2
 _scratch_dev_pool_get 2
 
-enable_io_failure()
-{
-	local sysfs_bdev=`_sysfs_dev $1`
-
-	echo 1 > $sysfs_bdev/make-it-fail
-}
-
-disable_io_failure()
-{
-	local sysfs_bdev=`_sysfs_dev $1`
-
-	echo 0 > $sysfs_bdev/make-it-fail
-}
-
 _check_minimal_fs_size $(( 1024 * 1024 * 1024 ))
 _scratch_pool_mkfs "-d raid1 -b 1G" >> $seqres.full 2>&1
 
@@ -43,15 +29,12 @@ pagesize=$(get_page_size)
 blocksize=$(_get_block_size $SCRATCH_MNT)
 sectors_per_page=$(($pagesize / $blocksize))
 
-# enable block I/O error injection
-echo 100 > $DEBUGFS_MNT/fail_make_request/probability
-echo 1000 > $DEBUGFS_MNT/fail_make_request/times
-echo 0 > $DEBUGFS_MNT/fail_make_request/verbose
+_allow_fail_make_request
 
 echo "Step 1: writing with one failing mirror:"
-enable_io_failure $SCRATCH_DEV
+_bdev_fail_make_request $SCRATCH_DEV 1
 $XFS_IO_PROG -f -c "pwrite -W -S 0xaa 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io
-disable_io_failure $SCRATCH_DEV
+_bdev_fail_make_request $SCRATCH_DEV 0
 
 errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
 	$AWK_PROG '/write_io_errs/ { print $2 }')
@@ -63,15 +46,13 @@ echo "Step 2: verify that the data reads back fine:"
 $XFS_IO_PROG -c "pread -v 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io_offset
 
 echo "Step 3: writing with two failing mirrors (should fail):"
-enable_io_failure $SCRATCH_DEV
-enable_io_failure $dev2
+_bdev_fail_make_request $SCRATCH_DEV 1
+_bdev_fail_make_request $dev2 1
 $XFS_IO_PROG -f -c "pwrite -W -S 0xbb 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io
-disable_io_failure $dev2
-disable_io_failure $SCRATCH_DEV
+_bdev_fail_make_request $dev2 0
+_bdev_fail_make_request $SCRATCH_DEV 0
 
-# disable block I/O error injection
-echo 0 > $DEBUGFS_MNT/fail_make_request/probability
-echo 0 > $DEBUGFS_MNT/fail_make_request/times
+_disallow_fail_make_request
 
 _scratch_dev_pool_put
 # success, all done
diff --git a/tests/btrfs/271.out b/tests/btrfs/271.out
index 27451c37..d58c92f2 100644
--- a/tests/btrfs/271.out
+++ b/tests/btrfs/271.out
@@ -1,4 +1,5 @@
 QA output created by 271
+Allow global fail_make_request feature
 Step 1: writing with one failing mirror:
 wrote 8192/8192 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -519,3 +520,4 @@ read 8192/8192 bytes
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Step 3: writing with two failing mirrors (should fail):
 fsync: Input/output error
+Disallow global fail_make_request feature
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] btrfs/271: include common/fail_make_request
  2022-08-23 19:32 [PATCH 1/2] btrfs/271: include common/fail_make_request Christoph Hellwig
  2022-08-23 19:32 ` [PATCH 2/2] btrfs/271: use the common fail_request setup helpers Christoph Hellwig
@ 2022-08-24 15:06 ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2022-08-24 15:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-btrfs, fstests

On Tue, Aug 23, 2022 at 09:32:29PM +0200, Christoph Hellwig wrote:
> This tests needs the _require_fail_make_request helper from
> common/fail_make_request, so include that file to avoid a test failure.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Oops, sorry I forgot that. :/
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/btrfs/271 | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/btrfs/271 b/tests/btrfs/271
> index c21858d1..681fa965 100755
> --- a/tests/btrfs/271
> +++ b/tests/btrfs/271
> @@ -10,6 +10,7 @@
>  _begin_fstest auto quick raid
>  
>  . ./common/filter
> +. ./common/fail_make_request
>  
>  _supported_fs btrfs
>  _require_scratch
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] btrfs/271: use the common fail_request setup helpers
  2022-08-23 19:32 ` [PATCH 2/2] btrfs/271: use the common fail_request setup helpers Christoph Hellwig
@ 2022-08-24 15:06   ` Darrick J. Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2022-08-24 15:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-btrfs, fstests

On Tue, Aug 23, 2022 at 09:32:30PM +0200, Christoph Hellwig wrote:
> Use the helpers from common/fail_make_request instead of open coding
> them.  This switches to using a higher error count than the existing
> code, which was the intention from the very beginning (and doesn't
> actuallt matter for the short sequences in this test).
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

A pretty straightforward conversion!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/btrfs/271     | 35 ++++++++---------------------------
>  tests/btrfs/271.out |  2 ++
>  2 files changed, 10 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/btrfs/271 b/tests/btrfs/271
> index 681fa965..c7c95b3e 100755
> --- a/tests/btrfs/271
> +++ b/tests/btrfs/271
> @@ -18,20 +18,6 @@ _require_fail_make_request
>  _require_scratch_dev_pool 2
>  _scratch_dev_pool_get 2
>  
> -enable_io_failure()
> -{
> -	local sysfs_bdev=`_sysfs_dev $1`
> -
> -	echo 1 > $sysfs_bdev/make-it-fail
> -}
> -
> -disable_io_failure()
> -{
> -	local sysfs_bdev=`_sysfs_dev $1`
> -
> -	echo 0 > $sysfs_bdev/make-it-fail
> -}
> -
>  _check_minimal_fs_size $(( 1024 * 1024 * 1024 ))
>  _scratch_pool_mkfs "-d raid1 -b 1G" >> $seqres.full 2>&1
>  
> @@ -43,15 +29,12 @@ pagesize=$(get_page_size)
>  blocksize=$(_get_block_size $SCRATCH_MNT)
>  sectors_per_page=$(($pagesize / $blocksize))
>  
> -# enable block I/O error injection
> -echo 100 > $DEBUGFS_MNT/fail_make_request/probability
> -echo 1000 > $DEBUGFS_MNT/fail_make_request/times
> -echo 0 > $DEBUGFS_MNT/fail_make_request/verbose
> +_allow_fail_make_request
>  
>  echo "Step 1: writing with one failing mirror:"
> -enable_io_failure $SCRATCH_DEV
> +_bdev_fail_make_request $SCRATCH_DEV 1
>  $XFS_IO_PROG -f -c "pwrite -W -S 0xaa 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io
> -disable_io_failure $SCRATCH_DEV
> +_bdev_fail_make_request $SCRATCH_DEV 0
>  
>  errs=$($BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
>  	$AWK_PROG '/write_io_errs/ { print $2 }')
> @@ -63,15 +46,13 @@ echo "Step 2: verify that the data reads back fine:"
>  $XFS_IO_PROG -c "pread -v 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io_offset
>  
>  echo "Step 3: writing with two failing mirrors (should fail):"
> -enable_io_failure $SCRATCH_DEV
> -enable_io_failure $dev2
> +_bdev_fail_make_request $SCRATCH_DEV 1
> +_bdev_fail_make_request $dev2 1
>  $XFS_IO_PROG -f -c "pwrite -W -S 0xbb 0 8K" $SCRATCH_MNT/foobar | _filter_xfs_io
> -disable_io_failure $dev2
> -disable_io_failure $SCRATCH_DEV
> +_bdev_fail_make_request $dev2 0
> +_bdev_fail_make_request $SCRATCH_DEV 0
>  
> -# disable block I/O error injection
> -echo 0 > $DEBUGFS_MNT/fail_make_request/probability
> -echo 0 > $DEBUGFS_MNT/fail_make_request/times
> +_disallow_fail_make_request
>  
>  _scratch_dev_pool_put
>  # success, all done
> diff --git a/tests/btrfs/271.out b/tests/btrfs/271.out
> index 27451c37..d58c92f2 100644
> --- a/tests/btrfs/271.out
> +++ b/tests/btrfs/271.out
> @@ -1,4 +1,5 @@
>  QA output created by 271
> +Allow global fail_make_request feature
>  Step 1: writing with one failing mirror:
>  wrote 8192/8192 bytes at offset 0
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> @@ -519,3 +520,4 @@ read 8192/8192 bytes
>  XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  Step 3: writing with two failing mirrors (should fail):
>  fsync: Input/output error
> +Disallow global fail_make_request feature
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-24 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 19:32 [PATCH 1/2] btrfs/271: include common/fail_make_request Christoph Hellwig
2022-08-23 19:32 ` [PATCH 2/2] btrfs/271: use the common fail_request setup helpers Christoph Hellwig
2022-08-24 15:06   ` Darrick J. Wong
2022-08-24 15:06 ` [PATCH 1/2] btrfs/271: include common/fail_make_request Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).