Message ID | 1658219473-2310-2-git-send-email-xuyang2018.jy@fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/2] xfs/270: Fix syntax error | expand |
On Tue, Jul 19, 2022 at 04:31:13PM +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@fujitsu.com> > --- > tests/xfs/533 | 34 ++++++++++++++++++++++++++++++++++ > tests/xfs/533.out | 5 +++++ > 2 files changed, 39 insertions(+) > create mode 100755 tests/xfs/533 > create mode 100644 tests/xfs/533.out > > diff --git a/tests/xfs/533 b/tests/xfs/533 > new file mode 100755 > index 00000000..c0a4c0d2 > --- /dev/null > +++ b/tests/xfs/533 > @@ -0,0 +1,34 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved. > +# > +# FS QA Test 533 > +# > +# 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 db > + > +# real QA test starts here > +_supported_fs xfs > +_fixed_by_git_commit xfsprogs f4afdcb0ad11 \ > + "xfs_db: clean up the salvage read callsites in set_cur()" > +#skip fs check because invalid superblock 1 > +_require_scratch_nocheck > + > +_scratch_mkfs_xfs >>$seqres.full 2>&1 > + > +# write the bad magicnum field value(0) to the superblock 1 > +_scratch_xfs_set_metadata_field "magicnum" "0" "sb 1" > + > +#Even magicnum filed has been corrupted, we still can read this filed value "field"? With that fixed, this looks good to me... Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > +_scratch_xfs_get_metadata_field "magicnum" "sb 1" > + > +# success, all done > +status=0 > +exit > diff --git a/tests/xfs/533.out b/tests/xfs/533.out > new file mode 100644 > index 00000000..7deb78a3 > --- /dev/null > +++ b/tests/xfs/533.out > @@ -0,0 +1,5 @@ > +QA output created by 533 > +Allowing write of corrupted data with good CRC > +magicnum = 0 > +bad magic number > +0 > -- > 2.23.0 >
diff --git a/tests/xfs/533 b/tests/xfs/533 new file mode 100755 index 00000000..c0a4c0d2 --- /dev/null +++ b/tests/xfs/533 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved. +# +# FS QA Test 533 +# +# 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 db + +# real QA test starts here +_supported_fs xfs +_fixed_by_git_commit xfsprogs f4afdcb0ad11 \ + "xfs_db: clean up the salvage read callsites in set_cur()" +#skip fs check because invalid superblock 1 +_require_scratch_nocheck + +_scratch_mkfs_xfs >>$seqres.full 2>&1 + +# write the bad magicnum field value(0) to the superblock 1 +_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/533.out b/tests/xfs/533.out new file mode 100644 index 00000000..7deb78a3 --- /dev/null +++ b/tests/xfs/533.out @@ -0,0 +1,5 @@ +QA output created by 533 +Allowing write of corrupted data with good CRC +magicnum = 0 +bad magic number +0
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@fujitsu.com> --- tests/xfs/533 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/533.out | 5 +++++ 2 files changed, 39 insertions(+) create mode 100755 tests/xfs/533 create mode 100644 tests/xfs/533.out