public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: "zhangyi (F)" <yi.zhang@huawei.com>
Cc: eguan@redhat.com, fstests@vger.kernel.org,
	linux-unionfs@vger.kernel.org, miklos@szeredi.hu,
	amir73il@gmail.com, miaoxie@huawei.com, yangerkun@huawei.com
Subject: Re: [xfstests PATCH v4 2/5] overlay: hook filesystem check helper
Date: Mon, 26 Feb 2018 22:51:01 +0800	[thread overview]
Message-ID: <20180226145101.GB6209@localhost.localdomain> (raw)
In-Reply-To: <20180222021834.26145-3-yi.zhang@huawei.com>

Hi zhangyi,

I was testing v4 patchset with various overlay configs and results all
look good, thanks! But I found more minor issues that can be improved.

On Thu, Feb 22, 2018 at 10:18:31AM +0800, zhangyi (F) wrote:
> Hook filesystem check helper to _check_test_fs and _check_scratch_fs for
> constants underlying dirs of overlay filesystem, and introduce scratch

"for constants underlying..." looks confusing, do you mean

... for checking consistency of underlying dirs of overlay filesystem

?

> check helpers for optionally lower/upper/work dirs. These helpers works

I'm not sure I understand what "optionally" means here..

> only if fsck.overlay exists.
> 
> This patch introduce OVERLAY_FSCK_OPTIONS use for check overlayfs like
> OVERLAY_MOUNT_OPTIONS, and also introduce a mount point check helper in
> common/rc to detect a dir is a mount point or not.
> 
> [ _check_test_fs/_check_scratch_fs part picked from Amir's patch, thanks ]
> 
> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
> ---
>  README.overlay |  10 ++++-
>  common/config  |   4 ++
>  common/overlay | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  common/rc      |  18 ++++++++-
>  4 files changed, 153 insertions(+), 4 deletions(-)
> 
> diff --git a/README.overlay b/README.overlay
> index dfb8234..9feaa6a 100644
> --- a/README.overlay
> +++ b/README.overlay
> @@ -22,6 +22,10 @@ the base fs should be pre-formatted before starting the -overlay run.
>  An easy way to accomplish this is by running './check <some test>' once,
>  before running './check -overlay'.
>  
> +'./check -overlay' support check overlay test and scratch dirs,
> +OVERLAY_FSCK_OPTIONS should be set instead of FSCK_OPTIONS if fsck
> +options need to given directly.
> +
>  Because of the lack of mkfs support, multi-section config files are only
>  partly supported with './check -overlay'. Only multi-section files that
>  do not change FSTYP and MKFS_OPTIONS can be safely used with -overlay.
> @@ -40,7 +44,9 @@ run overlay tests on the same base fs, but with different mount options:
>   MOUNT_OPTIONS="-o pquota"
>   TEST_FS_MOUNT_OPTS="-o noatime"
>   OVERLAY_MOUNT_OPTIONS="-o redirect_dir=off"
> + OVERLAY_FSCK_OPTIONS="-n"
>  
>  In the example above, MOUNT_OPTIONS will be used to mount the base scratch fs,
> -TEST_FS_MOUNT_OPTS will be used to mount the base test fs and
> -OVERLAY_MOUNT_OPTIONS will be used to mount both test and scratch overlays.
> +TEST_FS_MOUNT_OPTS will be used to mount the base test fs,
> +OVERLAY_MOUNT_OPTIONS will be used to mount both test and scratch overlay and
> +OVERLAY_FSCK_OPTIONS will be used to check both test and scratch overlay.
> diff --git a/common/config b/common/config
> index 71115bd..20f0e5f 100644
> --- a/common/config
> +++ b/common/config
> @@ -566,6 +566,10 @@ _overlay_config_override()
>  	# Set SCRATCH vars to overlay base and mount dirs inside base fs
>  	export SCRATCH_DEV="$OVL_BASE_SCRATCH_MNT"
>  	export SCRATCH_MNT="$OVL_BASE_SCRATCH_MNT/$OVL_MNT"
> +
> +	# Set fsck options, use default if user not set directly.
> +	export FSCK_OPTIONS="$OVERLAY_FSCK_OPTIONS"
> +	[ -z "$FSCK_OPTIONS" ] && _fsck_opts
>  }
>  
>  _overlay_config_restore()
> diff --git a/common/overlay b/common/overlay
> index a8b0e93..29f9bf8 100644
> --- a/common/overlay
> +++ b/common/overlay
> @@ -190,3 +190,128 @@ _overlay_fsck_dirs()
>  	$FSCK_OVERLAY_PROG -o lowerdir=$lowerdir -o upperdir=$upperdir \
>  			   -o workdir=$workdir $*
>  }
> +
> +_overlay_check_dirs()
> +{
> +	local lowerdir=$1
> +	local upperdir=$2
> +	local workdir=$3
> +	local err=0
> +
> +	_overlay_fsck_dirs $* $FSCK_OPTIONS >>$tmp.fsck 2>&1
> +	if [ $? -ne 0 ]; then
> +		_log_err "_overlay_check_fs: overlayfs on $lowerdir,$upperdir,$workdir is inconsistent"
> +
> +		echo "*** fsck.overlay output ***"	>>$seqres.full
> +		cat $tmp.fsck				>>$seqres.full
> +		echo "*** end fsck.overlay output"	>>$seqres.full
> +
> +		echo "*** mount output ***"		>>$seqres.full
> +		_mount					>>$seqres.full
> +		echo "*** end mount output"		>>$seqres.full
> +
> +		err=1
> +	fi
> +	rm -f $tmp.fsck
> +
> +	return $err
> +}
> +
> +# Check the same mnt/dev of _check_overlay_scratch_fs, but check
> +# optionally lower/upper/work dirs of overlay filesystem, such as
> +# multiple lower layers.

These comments look confusing to me too. I think you mean
_overlay_check_scratch_dirs is similar to _check_overlay_scratch_fs, but
it needs lower/upper/work dirs provided as arguments, it's useful for
non-default setups such as multiple lower layers.

> +_overlay_check_scratch_dirs()

I don't think we need it either (sorry I missed it in previous reviews),
just call _overlay_check_dirs directly with proper arguments in patch
5/5 (and umount first if necessary). We already have many helpers for
checking overlayfs, this one just makes it more confusing.

(At least this helper should be introduced in patch 5/5, along with its
first usage.)

Thanks,
Eryu

  parent reply	other threads:[~2018-02-26 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22  2:18 [xfstests PATCH v4 0/5] overlay: add overlay filesystem dirs check zhangyi (F)
2018-02-22  2:18 ` [xfstests PATCH v4 1/5] common/rc: improve dev mounted check helper zhangyi (F)
2018-02-22  2:18 ` [xfstests PATCH v4 2/5] overlay: hook filesystem " zhangyi (F)
     [not found]   ` <CAOQ4uxhH3ZLO6zehBY=U3guSvrZc_-bmBK1-2wQMZ+NMqVsX+A@mail.gmail.com>
2018-02-22  6:27     ` zhangyi (F)
2018-02-22  7:06       ` Amir Goldstein
2018-02-22  7:51         ` zhangyi (F)
2018-02-22  8:00           ` zhangyi (F)
2018-02-26 14:51   ` Eryu Guan [this message]
2018-02-27  1:51     ` zhangyi (F)
2018-02-22  2:18 ` [xfstests PATCH v4 3/5] overlay/003: fix fs check failure zhangyi (F)
2018-02-22  2:18 ` [xfstests PATCH v4 4/5] overlay: skip check for tests finished with corrupt filesystem zhangyi (F)
2018-02-22  2:18 ` [xfstests PATCH v4 5/5] overlay: correct scratch dirs check zhangyi (F)

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=20180226145101.GB6209@localhost.localdomain \
    --to=guaneryu@gmail.com \
    --cc=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=miklos@szeredi.hu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox