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@xxxxxxxx>
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