All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Anand Jain <anand.jain@oracle.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
	fdmanana@kernel.org
Subject: Re: [PATCH v2 2/3] btrfs/290: fix btrfs_corrupt_block options
Date: Wed, 24 Apr 2024 22:39:06 +0800	[thread overview]
Message-ID: <20240424143906.44xupen7czhdxppb@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com> (raw)
In-Reply-To: <4a6cada1ad70ca1f9cbb825d763364b71ac35514.1711097698.git.anand.jain@oracle.com>

On Fri, Mar 22, 2024 at 04:46:40PM +0530, Anand Jain wrote:
> Checks if the running btrfs-corrupt-block also has the options value and
> offset.
> 
> Remove btrfs-corrupt-block command's STDOUT and STDERR output redirection
> to /dev/null. Without this, debugging wasn't possible. I also noticed that
> command is quiet when successfull, so no redirect to $seqres.full is required.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---

Good to me,

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/btrfs/290 | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/btrfs/290 b/tests/btrfs/290
> index 61e741faeb45..281333b200f9 100755
> --- a/tests/btrfs/290
> +++ b/tests/btrfs/290
> @@ -31,7 +31,8 @@ _require_odirect
>  _require_xfs_io_command "falloc"
>  _require_xfs_io_command "pread"
>  _require_xfs_io_command "pwrite"
> -_require_btrfs_corrupt_block
> +_require_btrfs_corrupt_block "value"
> +_require_btrfs_corrupt_block "offset"
>  _disable_fsverity_signatures
>  
>  get_ino() {
> @@ -58,7 +59,7 @@ corrupt_inline() {
>  	_scratch_unmount
>  	# inline data starts at disk_bytenr
>  	# overwrite the first u64 with random bogus junk
> -	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f disk_bytenr $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f disk_bytenr $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -72,7 +73,7 @@ corrupt_prealloc_to_reg() {
>  	_scratch_unmount
>  	# ensure non-zero at the pre-allocated region on disk
>  	# set extent type from prealloc (2) to reg (1)
> -	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f type -v 1 $SCRATCH_DEV >/dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f type --value 1 $SCRATCH_DEV
>  	_scratch_mount
>  	# now that it's a regular file, reading actually looks at the previously
>  	# preallocated region, so ensure that has non-zero contents.
> @@ -88,7 +89,7 @@ corrupt_reg_to_prealloc() {
>  	_fsv_enable $f
>  	_scratch_unmount
>  	# set type from reg (1) to prealloc (2)
> -	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f type -v 2 $SCRATCH_DEV >/dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 0 -f type --value 2 $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -104,7 +105,8 @@ corrupt_punch_hole() {
>  	_fsv_enable $f
>  	_scratch_unmount
>  	# change disk_bytenr to 0, representing a hole
> -	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 4096 -f disk_bytenr -v 0 $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 4096 -f disk_bytenr --value 0 \
> +								    $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -118,7 +120,8 @@ corrupt_plug_hole() {
>  	_fsv_enable $f
>  	_scratch_unmount
>  	# change disk_bytenr to some value, plugging the hole
> -	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 4096 -f disk_bytenr -v 13639680 $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -i $ino -x 4096 -f disk_bytenr \
> +						   --value 13639680 $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -132,7 +135,8 @@ corrupt_verity_descriptor() {
>  	_scratch_unmount
>  	# key for the descriptor item is <inode, BTRFS_VERITY_DESC_ITEM_KEY, 1>,
>  	# 88 is X. So we write 5 Xs to the start of the descriptor
> -	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,36,1 -v 88 -o 0 -b 5 $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,36,1 --value 88 --offset 0 -b 5 \
> +								    $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -144,7 +148,8 @@ corrupt_root_hash() {
>  	local ino=$(get_ino $f)
>  	_fsv_enable $f
>  	_scratch_unmount
> -	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,36,1 -v 88 -o 16 -b 1 $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,36,1 --value 88 --offset 16 -b 1 \
> +								    $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> @@ -159,7 +164,8 @@ corrupt_merkle_tree() {
>  	# key for the descriptor item is <inode, BTRFS_VERITY_MERKLE_ITEM_KEY, 0>,
>  	# 88 is X. So we write 5 Xs to somewhere in the middle of the first
>  	# merkle item
> -	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 -v 88 -o 100 -b 5 $SCRATCH_DEV > /dev/null 2>&1
> +	$BTRFS_CORRUPT_BLOCK_PROG -r 5 -I $ino,37,0 --value 88 --offset 100 \
> +							       -b 5 $SCRATCH_DEV
>  	_scratch_mount
>  	validate $f
>  }
> -- 
> 2.39.3
> 
> 


  reply	other threads:[~2024-04-24 14:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 11:16 [PATCH v2 0/3] fix btrfs-corrupt-block options value and offset Anand Jain
2024-03-22 11:16 ` [PATCH v2 1/3] common/btrfs: refactor _require_btrfs_corrupt_block to check option Anand Jain
2024-04-24 14:37   ` Zorro Lang
2024-03-22 11:16 ` [PATCH v2 2/3] btrfs/290: fix btrfs_corrupt_block options Anand Jain
2024-04-24 14:39   ` Zorro Lang [this message]
2024-03-22 11:16 ` [PATCH v2 3/3] common/verity: fix btrfs-corrupt-block -v option Anand Jain
2024-04-24 14:45   ` Zorro Lang

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=20240424143906.44xupen7czhdxppb@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com \
    --to=zlang@redhat.com \
    --cc=anand.jain@oracle.com \
    --cc=fdmanana@kernel.org \
    --cc=fstests@vger.kernel.org \
    --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.