FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] btrfs: verify data checksum during _check_btrfs_filesystem()
@ 2023-06-13  7:14 Qu Wenruo
  2023-06-13  8:10 ` Qu Wenruo
  0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2023-06-13  7:14 UTC (permalink / raw)
  To: linux-btrfs, fstests

By default btrfs only checks the metadata consistency, but sometimes if
we have some corruption in data while the test case doesn't utilize
scrub to verify, or there is some bugs in scrub itself, we will not
detect those problems.

So here we do one step further by utilizing --check-data-csum option, so
that if there is some data corruption, we can detect them early.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/btrfs b/common/btrfs
index bd4dc31fa5a8..be8ac04cd9a3 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -144,7 +144,7 @@ _check_btrfs_filesystem()
 		rm -f $tmp.qgroup_report
 	fi
 
-	$BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
+	$BTRFS_UTIL_PROG check --check-data-csum $device >$tmp.fsck 2>&1
 	if [ $? -ne 0 ]; then
 		_log_err "_check_btrfs_filesystem: filesystem on $device is inconsistent"
 		echo "*** fsck.$FSTYP output ***"	>>$seqres.full
-- 
2.41.0


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

* Re: [PATCH] btrfs: verify data checksum during _check_btrfs_filesystem()
  2023-06-13  7:14 [PATCH] btrfs: verify data checksum during _check_btrfs_filesystem() Qu Wenruo
@ 2023-06-13  8:10 ` Qu Wenruo
  0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2023-06-13  8:10 UTC (permalink / raw)
  To: linux-btrfs, fstests



On 2023/6/13 15:14, Qu Wenruo wrote:
> By default btrfs only checks the metadata consistency, but sometimes if
> we have some corruption in data while the test case doesn't utilize
> scrub to verify, or there is some bugs in scrub itself, we will not
> detect those problems.
> 
> So here we do one step further by utilizing --check-data-csum option, so
> that if there is some data corruption, we can detect them early.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

This is a little overkilled, for example btrfs/215 intentionally corrupt 
some data for testing, thus this would cause false alerts.

I'll try to find a way to append options so that test cases can 
determine if they want checksum verification case by case.

Thanks,
Qu
> ---
>   common/btrfs | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index bd4dc31fa5a8..be8ac04cd9a3 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -144,7 +144,7 @@ _check_btrfs_filesystem()
>   		rm -f $tmp.qgroup_report
>   	fi
>   
> -	$BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
> +	$BTRFS_UTIL_PROG check --check-data-csum $device >$tmp.fsck 2>&1
>   	if [ $? -ne 0 ]; then
>   		_log_err "_check_btrfs_filesystem: filesystem on $device is inconsistent"
>   		echo "*** fsck.$FSTYP output ***"	>>$seqres.full

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

end of thread, other threads:[~2023-06-13  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13  7:14 [PATCH] btrfs: verify data checksum during _check_btrfs_filesystem() Qu Wenruo
2023-06-13  8:10 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox