fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Eryu Guan <guaneryu@gmail.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>, Eryu Guan <guan@eryu.me>
Subject: Re: [PATCH 4/4] xfs: test upgrading filesystem to bigtime
Date: Wed, 21 Apr 2021 09:18:33 +0300	[thread overview]
Message-ID: <CAOQ4uxi8Bh8OYS-D6u=+U=uEdaO3EkoHce_rg6-0dyHQhG-sfw@mail.gmail.com> (raw)
In-Reply-To: <161896460627.776452.15178871770338402214.stgit@magnolia>

On Wed, Apr 21, 2021 at 3:23 AM Darrick J. Wong <djwong@kernel.org> wrote:
>
> From: Darrick J. Wong <djwong@kernel.org>
>
> Test that we can upgrade an existing filesystem to use bigtime.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  common/xfs        |   16 ++++++
>  tests/xfs/908     |  117 ++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/908.out |   29 ++++++++++
>  tests/xfs/909     |  149 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/909.out |    6 ++
>  tests/xfs/group   |    2 +
>  6 files changed, 319 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 cb6a1978..253a31e5 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -1184,3 +1184,19 @@ _xfs_timestamp_range()
>                         awk '{printf("%s %s", $1, $2);}'
>         fi
>  }
> +
> +# Require that the scratch device exists, that mkfs can format with bigtime
> +# enabled, that the kernel can mount such a filesystem, and that xfs_info
> +# advertises the presence of that feature.
> +_require_scratch_xfs_bigtime()
> +{
> +       _require_scratch
> +
> +       _scratch_mkfs -m bigtime=1 &>/dev/null || \
> +               _notrun "mkfs.xfs doesn't support bigtime feature"
> +       _try_scratch_mount || \
> +               _notrun "kernel doesn't support xfs bigtime feature"
> +       $XFS_INFO_PROG "$SCRATCH_MNT" | grep -q -w "bigtime=1" || \
> +               _notrun "bigtime feature not advertised on mount?"
> +       _scratch_unmount
> +}
> diff --git a/tests/xfs/908 b/tests/xfs/908
> new file mode 100755
> index 00000000..004a8563
> --- /dev/null
> +++ b/tests/xfs/908
> @@ -0,0 +1,117 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 Oracle.  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
> +_require_command "$XFS_ADMIN_PROG" "xfs_admin"
> +_require_scratch_xfs_bigtime
> +_require_xfs_repair_upgrade 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
> +
> +# Make sure we can't upgrade a V4 filesystem
> +_scratch_mkfs -m crc=0 >> $seqres.full
> +_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
> +_check_scratch_xfs_features BIGTIME
> +
> +# Make sure we're required to specify a feature status
> +_scratch_mkfs -m crc=1,bigtime=0,inobtcount=0 >> $seqres.full
> +_scratch_xfs_admin -O bigtime 2>> $seqres.full
> +
> +# Can we add bigtime and inobtcount at the same time?
> +_scratch_mkfs -m crc=1,bigtime=0,inobtcount=0 >> $seqres.full
> +_scratch_xfs_admin -O bigtime=1,inobtcount=1 2>> $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 -d 'Jan 9 19:19:19 UTC 1999' $SCRATCH_MNT/a
> +touch -d 'Jan 9 19:19:19 UTC 1999' $SCRATCH_MNT/b
> +ls -la $SCRATCH_MNT/* >> $seqres.full
> +
> +echo before upgrade:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +_scratch_unmount
> +_check_scratch_fs
> +
> +# Now upgrade to bigtime support
> +_scratch_xfs_admin -O bigtime=1 2>> $seqres.full
> +_check_scratch_xfs_features BIGTIME
> +_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
> +
> +echo after upgrade:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +# Bump one of the timestamps but stay under 2038
> +touch -d 'Jan 10 19:19:19 UTC 1999' $SCRATCH_MNT/a
> +
> +echo after upgrade and bump:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +_scratch_cycle_mount
> +
> +# Did the bumped timestamp survive the remount?
> +ls -la $SCRATCH_MNT/* >> $seqres.full
> +
> +echo after upgrade, bump, and remount:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +# Modify the other timestamp to stretch beyond 2038
> +touch -d 'Feb 22 22:22:22 UTC 2222' $SCRATCH_MNT/b
> +
> +echo after upgrade and extension:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +_scratch_cycle_mount
> +
> +# Did the timestamp survive the remount?
> +ls -la $SCRATCH_MNT/* >> $seqres.full
> +
> +echo after upgrade, extension, and remount:
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/a
> +TZ=UTC stat -c '%Y' $SCRATCH_MNT/b
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/908.out b/tests/xfs/908.out
> new file mode 100644
> index 00000000..5e05854d
> --- /dev/null
> +++ b/tests/xfs/908.out
> @@ -0,0 +1,29 @@
> +QA output created by 908
> +Running xfs_repair to upgrade filesystem.
> +Large timestamp feature only supported on V5 filesystems.
> +FEATURES: BIGTIME:NO
> +Running xfs_repair to upgrade filesystem.
> +Running xfs_repair to upgrade filesystem.
> +Adding inode btree counts to filesystem.
> +Adding large timestamp support to filesystem.
> +before upgrade:
> +915909559
> +915909559
> +Running xfs_repair to upgrade filesystem.
> +Adding large timestamp support to filesystem.
> +FEATURES: BIGTIME:YES
> +after upgrade:
> +915909559
> +915909559
> +after upgrade and bump:
> +915995959
> +915909559
> +after upgrade, bump, and remount:
> +915995959
> +915909559

Did you design those following days timestamps to look so cool? ;-)

> +after upgrade and extension:
> +915995959
> +7956915742
> +after upgrade, extension, and remount:
> +915995959
> +7956915742

Consider this test reviewed-by-me
I'd like more eyes on the quota grace period test, so not providing
a reviewed-by tag for the entire patch.

Thanks,
Amir.

  reply	other threads:[~2021-04-21  6:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  0:23 [PATCHSET v4 0/4] fstests: widen timestamps to deal with y2038+ Darrick J. Wong
2021-04-21  0:23 ` [PATCH 1/4] generic: check userspace handling of extreme timestamps Darrick J. Wong
2021-04-22 21:16   ` Allison Henderson
2021-04-23  1:07     ` Darrick J. Wong
2021-04-21  0:23 ` [PATCH 2/4] xfs/122: add legacy timestamps to ondisk checker Darrick J. Wong
2021-04-22 21:16   ` Allison Henderson
2021-04-21  0:23 ` [PATCH 3/4] xfs: detect time limits from filesystem Darrick J. Wong
2021-04-22 21:16   ` Allison Henderson
2021-04-21  0:23 ` [PATCH 4/4] xfs: test upgrading filesystem to bigtime Darrick J. Wong
2021-04-21  6:18   ` Amir Goldstein [this message]
2021-04-21 16:41     ` Darrick J. Wong
2021-04-22 21:16   ` Allison Henderson
2021-04-25  7:21   ` Eryu Guan
2021-04-25 15:42     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2021-03-31  1:08 [PATCHSET 0/4] fstests: widen timestamps to deal with y2038+ Darrick J. Wong
2021-03-31  1:08 ` [PATCH 4/4] xfs: test upgrading filesystem to bigtime Darrick J. Wong
2021-03-31  9:49   ` Amir Goldstein
2021-03-31 15:56     ` Darrick J. Wong
2021-04-11 13:40   ` Eryu Guan
2021-04-12 17:43     ` Darrick J. Wong
2020-10-27 19:03 [PATCH RFC v6 0/4] xfstests: widen timestamps to deal with y2038+ Darrick J. Wong
2020-10-27 19:04 ` [PATCH 4/4] xfs: test upgrading filesystem to bigtime Darrick J. Wong
2020-10-29 13:06   ` Amir Goldstein
2020-10-29 18:22     ` Darrick J. Wong
2020-08-17 23:00 [PATCH RFC 0/4] xfstests: widen timestamps to deal with y2038 Darrick J. Wong
2020-08-17 23:01 ` [PATCH 4/4] xfs: test upgrading filesystem to bigtime Darrick J. Wong
2020-08-18  6:16   ` Amir Goldstein
2020-08-18 18:23     ` Darrick J. Wong
2020-08-18 18:40       ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOQ4uxi8Bh8OYS-D6u=+U=uEdaO3EkoHce_rg6-0dyHQhG-sfw@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).