From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Test that we can upgrade an existing filesystem to use bigtime. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- common/xfs | 16 +++++++++++ tests/xfs/908 | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/908.out | 3 ++ tests/xfs/909 | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/909.out | 12 ++++++++ tests/xfs/group | 2 + 6 files changed, 184 insertions(+) create mode 100755 tests/xfs/908 create mode 100644 tests/xfs/908.out create mode 100755 tests/xfs/909 create mode 100644 tests/xfs/909.out diff --git a/common/xfs b/common/xfs index 252a5c0d..c0735a51 100644 --- a/common/xfs +++ b/common/xfs @@ -985,3 +985,19 @@ _xfs_timestamp_range() $dbprog -f -c 'timelimit --compact' | awk '{printf("%s %s", $1, $2);}' fi } + +_require_xfs_mkfs_bigtime() +{ + _scratch_mkfs_xfs_supported -m bigtime=1 >/dev/null 2>&1 \ + || _notrun "mkfs.xfs doesn't have bigtime feature" +} + +_require_xfs_scratch_bigtime() +{ + _require_scratch + + _scratch_mkfs -m bigtime=1 > /dev/null + _try_scratch_mount || \ + _notrun "bigtime not supported by scratch filesystem type: $FSTYP" + _scratch_unmount +} diff --git a/tests/xfs/908 b/tests/xfs/908 new file mode 100755 index 00000000..e313e14b --- /dev/null +++ b/tests/xfs/908 @@ -0,0 +1,74 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 908 +# +# Check that we can upgrade a filesystem to support bigtime and that inode +# timestamps work properly after the upgrade. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_xfs_mkfs_crc +_require_xfs_mkfs_bigtime +_require_xfs_scratch_bigtime + +date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \ + _notrun "Userspace does not support dates past 2038." + +rm -f $seqres.full + +# Format V5 filesystem without bigtime support and populate it +_scratch_mkfs -m crc=1,bigtime=0 > $seqres.full +_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full +_scratch_mount >> $seqres.full + +touch $SCRATCH_MNT/a +touch $SCRATCH_MNT/b +ls -la $SCRATCH_MNT/* >> $seqres.full + +_scratch_unmount +_check_scratch_fs + +# Now upgrade to bigtime support +_scratch_xfs_admin -O bigtime >> $seqres.full +_check_scratch_fs +_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full + +# Mount again, look at our files +_scratch_mount >> $seqres.full +ls -la $SCRATCH_MNT/* >> $seqres.full + +# Modify some timestamps +touch -d 'Feb 22 22:22:22 UTC 2222' $SCRATCH_MNT/b + +_scratch_cycle_mount + +# Did the timestamp survive? +ls -la $SCRATCH_MNT/* >> $seqres.full +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b + +# success, all done +echo Silence is golden. +status=0 +exit diff --git a/tests/xfs/908.out b/tests/xfs/908.out new file mode 100644 index 00000000..38fdf6b3 --- /dev/null +++ b/tests/xfs/908.out @@ -0,0 +1,3 @@ +QA output created by 908 +7956915742 +Silence is golden. diff --git a/tests/xfs/909 b/tests/xfs/909 new file mode 100755 index 00000000..8d8675da --- /dev/null +++ b/tests/xfs/909 @@ -0,0 +1,77 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test No. 909 +# +# Check that we can upgrade a filesystem to support bigtime and that quota +# timers work properly after the upgrade. + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_quota +_require_xfs_mkfs_crc +_require_xfs_mkfs_bigtime +_require_xfs_scratch_bigtime + +date --date='Jan 1 00:00:00 UTC 2040' > /dev/null 2>&1 || \ + _notrun "Userspace does not support dates past 2038." + +rm -f $seqres.full + +# Format V5 filesystem without bigtime support and populate it +_scratch_mkfs -m crc=1,bigtime=0 > $seqres.full +_qmount_option "usrquota" +_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full +_scratch_mount >> $seqres.full + +touch $SCRATCH_MNT/a +touch $SCRATCH_MNT/b +$XFS_QUOTA_PROG -x -c 'timer -u 300m' $SCRATCH_MNT +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' + +_scratch_unmount + +# Now upgrade to bigtime support +_scratch_xfs_admin -O bigtime >> $seqres.full +_check_scratch_fs +_scratch_xfs_db -c 'version' -c 'sb 0' -c 'p' >> $seqres.full + +# Mount again, see if our quota timer survived +_scratch_mount +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' + +# Create a file to force the dirty dquot out to disk +touch -d 'Feb 22 22:22:22 UTC 2222' $SCRATCH_MNT/b + +_scratch_cycle_mount + +# Did the timer (and the timestamp) survive? +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b +$XFS_QUOTA_PROG -x -c 'state' $SCRATCH_MNT | grep 'grace time' + +# success, all done +echo Silence is golden. +status=0 +exit diff --git a/tests/xfs/909.out b/tests/xfs/909.out new file mode 100644 index 00000000..70e1b082 --- /dev/null +++ b/tests/xfs/909.out @@ -0,0 +1,12 @@ +QA output created by 909 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +7956915742 +Blocks grace time: [0 days 05:00:00] +Inodes grace time: [0 days 05:00:00] +Realtime Blocks grace time: [0 days 05:00:00] +Silence is golden. diff --git a/tests/xfs/group b/tests/xfs/group index 0063fd19..93fdaba9 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -531,6 +531,8 @@ 746 auto quick online_repair 747 auto quick scrub 748 auto quick scrub +908 auto quick bigtime +909 auto quick bigtime quota 910 auto quick inobtcount 911 auto quick bigtime 915 auto quick quota