All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Christoph Hellwig <hch@lst.de>,
	fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] common: provide generic block error injection helper
Date: Mon, 4 Jul 2022 23:00:57 +0800	[thread overview]
Message-ID: <21e90405-559d-d8ec-1c82-81cfab9819f5@oracle.com> (raw)
In-Reply-To: <20220704090346.108134-1-hch@lst.de>

On 04/07/2022 17:03, Christoph Hellwig wrote:
> Various tests have more or less copy and pasted code to enable and
> disable block layer "fail make request" error injection.  Move that
> to a set of common helpers and use those in the drivers.
> 

> btrfs/150 differened from the other two in a few ways, like selecting
> a not quite as big number to fail all requests in the small critical
> section and clearing a bunch of never set attributes in the failure
> injection configuration, but none of those matter for the test
> execution.

Hm. more below.


> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   common/inject     | 33 +++++++++++++++++++++++++++++++++
>   tests/btrfs/088   | 24 +++++-------------------
>   tests/btrfs/150   | 27 +++++----------------------
>   tests/generic/019 | 44 +++++++++-----------------------------------
>   4 files changed, 52 insertions(+), 76 deletions(-)
> 
> diff --git a/common/inject b/common/inject
> index 6b590804..137ff5fd 100644
> --- a/common/inject
> +++ b/common/inject
> @@ -111,3 +111,36 @@ _scratch_inject_error()
>   		_fail "Cannot inject error ${type} value ${value}."
>   	fi
>   }
> +
> +# enable block error injection globally
> +_enable_fail_make_request()
> +{
> +	echo 100 > $DEBUGFS_MNT/fail_make_request/probability

> +	echo 9999999 > $DEBUGFS_MNT/fail_make_request/times

Instead, can we do
    printf %#x -1  > $DEBUGFS_MNT/fail_make_request/times
(as in the documentation).


<snip>

> @@ -25,24 +26,6 @@ _require_fail_make_request
>   _require_scratch_dev_pool 2
>   _scratch_dev_pool_get 2
>   
> -SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
> -enable_io_failure()
> -{
> -	echo 100 > $DEBUGFS_MNT/fail_make_request/probability
> -	echo 1000 > $DEBUGFS_MNT/fail_make_request/times
> -	echo 0 > $DEBUGFS_MNT/fail_make_request/verbose


> -	echo 1 > $DEBUGFS_MNT/fail_make_request/task-filter
Only extra line in btrfs/150 is the above line (or did I miss any)?
Which is deleted in this patch.

Per 'task-filter' documentation
--------------
- /sys/kernel/debug/fail*/task-filter:

         Format: { 'Y' | 'N' }

         A value of 'N' disables filtering by process (default).
         Any positive value limits failures to only processes indicated by
         /proc/<pid>/make-it-fail==1.
--------------

<snip>

> -	enable_io_failure
> -
> +	_enable_fail_make_request
> +	_start_fail_dev $SCRATCH_DEV
>   	result=$(bash -c "
>   	if [ \$((\$\$ % 2)) == 1 ]; then

>   		echo 1 > /proc/\$\$/make-it-fail

  So this won't work now.

Thanks, Anand

  parent reply	other threads:[~2022-07-04 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04  9:03 [PATCH 1/2] common: provide generic block error injection helper Christoph Hellwig
2022-07-04  9:03 ` [PATCH 2/2] btrfs: test raid1 write error handling Christoph Hellwig
2022-07-04 15:00 ` Anand Jain [this message]
2022-07-05  7:43   ` [PATCH 1/2] common: provide generic block error injection helper Christoph Hellwig

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=21e90405-559d-d8ec-1c82-81cfab9819f5@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=linux-btrfs@vger.kernel.org \
    /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.