All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: fstests <fstests@vger.kernel.org>, Eryu Guan <guaneryu@gmail.com>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] generic: test i_mode recovery after power failure
Date: Tue, 5 Mar 2019 14:41:54 +0000	[thread overview]
Message-ID: <CAL3q7H5u28F8rOGAobzG=S2WGDxstLkOHJ__z2gpovH=VNNm1g@mail.gmail.com> (raw)
In-Reply-To: <20190305114744.129633-1-yuchao0@huawei.com>

On Tue, Mar 5, 2019 at 11:48 AM Chao Yu <yuchao0@huawei.com> wrote:
>
> After fsync, filesystem should guarantee inode metadata including
> permission info being persisted, so even after sudden power-cut,
> during mount, we should recover i_mode fields correctly, in order
> to not loss those meta info.
>
> So adding this testcase to check whether generic filesystem can
> guarantee that.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> v2:
> change as Filipe suggested:
> - use dmflakey to simulate power-cut for generic filesystem which
> doesn't support godown ioctl interface.
> - minor code style change.
>  tests/generic/532     | 105 ++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/532.out |   2 +
>  tests/generic/group   |   1 +
>  3 files changed, 108 insertions(+)
>  create mode 100755 tests/generic/532
>  create mode 100644 tests/generic/532.out
>
> diff --git a/tests/generic/532 b/tests/generic/532
> new file mode 100755
> index 000000000000..1c5dffcdc4f6
> --- /dev/null
> +++ b/tests/generic/532
> @@ -0,0 +1,105 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2019 Huawei.  All Rights Reserved.
> +#
> +# FS QA Test 532
> +#
> +# This testcase is trying to test recovery flow of generic filesystem,
> +# w/ below steps, once i_mode changes, after we fsync that file, we can
> +# expect that i_mode can be recovered after sudden power-cuts.
> +# 1. touch testfile or mkdir testdir
> +# 2. chmod 777 testfile/testdir
> +# 3. sync
> +# 4. chmod 755 testfile/testdir
> +# 5. fsync testfile/testdir
> +# 6. record last i_mode
> +# 7. flakey drop
> +# 8. remount
> +# 9. check i_mode
> +#
> +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()
> +{
> +       _cleanup_flakey
> +       cd /
> +       rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/dmflakey
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_scratch
> +_require_dm_target flakey
> +
> +_scratch_mkfs >/dev/null 2>&1
> +_require_metadata_journaling $SCRATCH_DEV
> +_init_flakey
> +
> +testfile=$SCRATCH_MNT/testfile
> +testdir=$SCRATCH_MNT/testdir
> +
> +do_check()
> +{
> +       local target=$1
> +       local is_dir=$2
> +
> +       _mount_flakey
> +
> +       if [ $is_dir = 1 ]; then
> +               mkdir $target
> +       else
> +               touch $target
> +       fi
> +
> +       echo "Test chmod $target" >> $seqres.full
> +
> +       chmod 777 $target
> +       sync
> +
> +       chmod 755 $target
> +       $XFS_IO_PROG $target -c "fsync"
> +
> +       local before=`stat -c %a $target`
> +
> +       _flakey_drop_and_remount
> +
> +       local after=`stat -c %a $target`
> +
> +       # check inode's i_mode
> +       if [ "$before" != "$after" ]; then
> +               echo "Before: $before"
> +               echo "After : $after"
> +       fi
> +
> +       if [ $is_dir = 1 ]; then
> +               rmdir $target
> +       else
> +               rm -f $target
> +       fi
> +       _unmount_flakey
> +}
> +
> +echo "Silence is golden"
> +
> +do_check $testfile 0
> +do_check $testdir 1
> +
> +status=0
> +exit
> diff --git a/tests/generic/532.out b/tests/generic/532.out
> new file mode 100644
> index 000000000000..1f7d4677c3be
> --- /dev/null
> +++ b/tests/generic/532.out
> @@ -0,0 +1,2 @@
> +QA output created by 532
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index 15227b6713f7..c19361667886 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -534,3 +534,4 @@
>  529 auto quick attr
>  530 auto quick unlink
>  531 auto quick unlink
> +532 shutdown auto quick metadata

Since the test now uses dmflakey, it should no longer belong to the
'shutdown' group and should
belong to the 'log' group like all other tests using dmflakey.
Probably Eryu can change that when
he picks the patch.

Other than that it looks good to me, thanks.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

> --
> 2.18.0.rc1
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

WARNING: multiple messages have this Message-ID (diff)
From: Filipe Manana <fdmanana@gmail.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: Eryu Guan <guaneryu@gmail.com>, fstests <fstests@vger.kernel.org>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] generic: test i_mode recovery after power failure
Date: Tue, 5 Mar 2019 14:41:54 +0000	[thread overview]
Message-ID: <CAL3q7H5u28F8rOGAobzG=S2WGDxstLkOHJ__z2gpovH=VNNm1g@mail.gmail.com> (raw)
In-Reply-To: <20190305114744.129633-1-yuchao0@huawei.com>

On Tue, Mar 5, 2019 at 11:48 AM Chao Yu <yuchao0@huawei.com> wrote:
>
> After fsync, filesystem should guarantee inode metadata including
> permission info being persisted, so even after sudden power-cut,
> during mount, we should recover i_mode fields correctly, in order
> to not loss those meta info.
>
> So adding this testcase to check whether generic filesystem can
> guarantee that.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> v2:
> change as Filipe suggested:
> - use dmflakey to simulate power-cut for generic filesystem which
> doesn't support godown ioctl interface.
> - minor code style change.
>  tests/generic/532     | 105 ++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/532.out |   2 +
>  tests/generic/group   |   1 +
>  3 files changed, 108 insertions(+)
>  create mode 100755 tests/generic/532
>  create mode 100644 tests/generic/532.out
>
> diff --git a/tests/generic/532 b/tests/generic/532
> new file mode 100755
> index 000000000000..1c5dffcdc4f6
> --- /dev/null
> +++ b/tests/generic/532
> @@ -0,0 +1,105 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2019 Huawei.  All Rights Reserved.
> +#
> +# FS QA Test 532
> +#
> +# This testcase is trying to test recovery flow of generic filesystem,
> +# w/ below steps, once i_mode changes, after we fsync that file, we can
> +# expect that i_mode can be recovered after sudden power-cuts.
> +# 1. touch testfile or mkdir testdir
> +# 2. chmod 777 testfile/testdir
> +# 3. sync
> +# 4. chmod 755 testfile/testdir
> +# 5. fsync testfile/testdir
> +# 6. record last i_mode
> +# 7. flakey drop
> +# 8. remount
> +# 9. check i_mode
> +#
> +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()
> +{
> +       _cleanup_flakey
> +       cd /
> +       rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/dmflakey
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +
> +_require_scratch
> +_require_dm_target flakey
> +
> +_scratch_mkfs >/dev/null 2>&1
> +_require_metadata_journaling $SCRATCH_DEV
> +_init_flakey
> +
> +testfile=$SCRATCH_MNT/testfile
> +testdir=$SCRATCH_MNT/testdir
> +
> +do_check()
> +{
> +       local target=$1
> +       local is_dir=$2
> +
> +       _mount_flakey
> +
> +       if [ $is_dir = 1 ]; then
> +               mkdir $target
> +       else
> +               touch $target
> +       fi
> +
> +       echo "Test chmod $target" >> $seqres.full
> +
> +       chmod 777 $target
> +       sync
> +
> +       chmod 755 $target
> +       $XFS_IO_PROG $target -c "fsync"
> +
> +       local before=`stat -c %a $target`
> +
> +       _flakey_drop_and_remount
> +
> +       local after=`stat -c %a $target`
> +
> +       # check inode's i_mode
> +       if [ "$before" != "$after" ]; then
> +               echo "Before: $before"
> +               echo "After : $after"
> +       fi
> +
> +       if [ $is_dir = 1 ]; then
> +               rmdir $target
> +       else
> +               rm -f $target
> +       fi
> +       _unmount_flakey
> +}
> +
> +echo "Silence is golden"
> +
> +do_check $testfile 0
> +do_check $testdir 1
> +
> +status=0
> +exit
> diff --git a/tests/generic/532.out b/tests/generic/532.out
> new file mode 100644
> index 000000000000..1f7d4677c3be
> --- /dev/null
> +++ b/tests/generic/532.out
> @@ -0,0 +1,2 @@
> +QA output created by 532
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index 15227b6713f7..c19361667886 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -534,3 +534,4 @@
>  529 auto quick attr
>  530 auto quick unlink
>  531 auto quick unlink
> +532 shutdown auto quick metadata

Since the test now uses dmflakey, it should no longer belong to the
'shutdown' group and should
belong to the 'log' group like all other tests using dmflakey.
Probably Eryu can change that when
he picks the patch.

Other than that it looks good to me, thanks.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

> --
> 2.18.0.rc1
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2019-03-05 14:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 11:47 [PATCH v2] generic: test i_mode recovery after power failure Chao Yu
2019-03-05 11:47 ` Chao Yu
2019-03-05 14:41 ` Filipe Manana [this message]
2019-03-05 14:41   ` Filipe Manana
2019-03-05 20:53 ` Dave Chinner
2019-03-05 20:53   ` Dave Chinner
2019-03-06  2:29   ` Chao Yu
2019-03-06  2:29     ` Chao Yu
2019-03-06  5:00     ` Dave Chinner
2019-03-06  5:00       ` Dave Chinner
2019-03-06  7:44       ` Amir Goldstein
2019-03-06  7:44         ` Amir Goldstein
2019-03-06 22:12         ` Dave Chinner
2019-03-06 22:12           ` Dave Chinner
2019-03-07  7:12           ` Amir Goldstein
2019-03-07  7:12             ` Amir Goldstein
2019-03-07 20:22             ` Dave Chinner
2019-03-07 20:22               ` Dave Chinner
2019-03-07 20:42               ` [f2fs-dev] " Jayashree Mohan
2019-03-07 20:42                 ` Jayashree Mohan
2019-03-09 10:15   ` Eryu Guan
2019-03-09 10:15     ` Eryu Guan

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='CAL3q7H5u28F8rOGAobzG=S2WGDxstLkOHJ__z2gpovH=VNNm1g@mail.gmail.com' \
    --to=fdmanana@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yuchao0@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.