Re: [PATCH v2 2/2] xfs/191: test xfs_db get corrupted value

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



on 2022/07/19 13:21, Zorro Lang wrote:
> On Tue, Jul 05, 2022 at 05:20:08PM +0800, Yang Xu wrote:
>> This is a regression test that xfs_db code doesn't clean up the
>> LIBXFS_READBUF_SALVAGE call sites in set_cur so that we
>> can't use the return value directly and scraping it out later.
>>
>> Signed-off-by: Yang Xu <xuyang2018.jy@xxxxxxxxxxx>
>> ---
>>   tests/xfs/191     | 33 +++++++++++++++++++++++++++++++++
>>   tests/xfs/191.out |  5 +++++
> 
> This seqnum has been taken, please rebase to latest xfstests for-next branch.

I will use xfs/533 seqnum.
> 
>>   2 files changed, 38 insertions(+)
>>   create mode 100755 tests/xfs/191
>>   create mode 100644 tests/xfs/191.out
>>
>> diff --git a/tests/xfs/191 b/tests/xfs/191
>> new file mode 100755
>> index 00000000..98e9e186
>> --- /dev/null
>> +++ b/tests/xfs/191
>> @@ -0,0 +1,33 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
>> +#
>> +# FS QA Test 191
>> +#
>> +# Regression test for xfsprogs commit
>> +# f4afdcb0ad11 ("xfs_db: clean up the salvage read callsites in set_cur()")
>> +#
>> +# This case test xfs_db whether can get the new magicnum field value even we
>> +# just have corrupted this field value.
>> +#
>> +
>> +. ./common/preamble
>> +_begin_fstest auto quick
> 
> This's a test for xfs_db, so add "db" test group please.

YES.
> 
>> +
>> +# Import common functions.
>> +. ./common/filter
> 
> Do you use any helpers in common/filter?

No, will remove.
> 
>> +
>> +# real QA test starts here
>> +_supported_fs xfs
> 
> _require_scratch_nocheck ??
> 
> And ...
> 
> _fixed_by_git_commit xfsprogs f4afdcb0ad11 \
> 	"xfs_db: clean up the salvage read callsites in set_cur()"

Yes, will add them in v3.

Best Regards
Yang Xu
> 
> Thanks,
> Zorro
> 
>> +
>> +_scratch_mkfs_xfs >>$seqres.full 2>&1
>> +
>> +# write the bad magicnum field value(0) to the superblock
>> +_scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
>> +
>> +#Even magicnum filed has been corrupted, we still can read this filed value
>> +_scratch_xfs_get_metadata_field "magicnum" "sb 1"
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/xfs/191.out b/tests/xfs/191.out
>> new file mode 100644
>> index 00000000..71826198
>> --- /dev/null
>> +++ b/tests/xfs/191.out
>> @@ -0,0 +1,5 @@
>> +QA output created by 191
>> +Allowing write of corrupted data with good CRC
>> +magicnum = 0
>> +bad magic number
>> +0
>> -- 
>> 2.27.0
>>
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux