public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "zhangyi (F)" <yi.zhang@huawei.com>
To: Amir Goldstein <amir73il@gmail.com>, Eryu Guan <guaneryu@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH v3 2/4] overlay: fix _repair_scratch_fs
Date: Thu, 30 May 2019 00:10:06 +0800	[thread overview]
Message-ID: <7cf2a5b5-ab05-ecec-32ef-00c2a401aa12@huawei.com> (raw)
In-Reply-To: <20190528151723.12525-3-amir73il@gmail.com>

On 2019/5/28 23:17, Amir Goldstein Wrote:
> _repair_scratch_fs did not do the right thing for overlay.
> Implement and call _repair_overlay_scratch_fs to repair
> overlay filesystem and then fall through to repair base filesystem.
> 
> The only tests currentrly calling _repair_scratch_fs on a
> ./check -overlay run are generic/330 generic/332 in case the
> base fs supports reflink. The rest of the tests calling
> _repair_scratch_fs require that $SCRATCH_DEV is a block device.
> 
> Suggested-by: zhangyi (F) <yi.zhang@huawei.com>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  common/overlay | 17 +++++++++++++++++
>  common/rc      | 13 +++++++++++--
>  2 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/common/overlay b/common/overlay
> index b526f24d..a71c2035 100644
> --- a/common/overlay
> +++ b/common/overlay
> @@ -320,3 +320,20 @@ _check_overlay_scratch_fs()
>  		"$OVL_BASE_SCRATCH_DEV" "$OVL_BASE_SCRATCH_MNT" \
>  		$OVL_BASE_MOUNT_OPTIONS $SELINUX_MOUNT_OPTIONS
>  }
> +
> +_repair_overlay_scratch_fs()
> +{
> +	_overlay_fsck_dirs $OVL_BASE_SCRATCH_MNT/$OVL_LOWER \
> +		$OVL_BASE_SCRATCH_MNT/$OVL_UPPER \
> +		$OVL_BASE_SCRATCH_MNT/$OVL_WORK -y
> +	local res=$?
> +	case $res in
> +	$FSCK_OK|$FSCK_NONDESTRUCT)
> +		res=0
> +		;;
> +	*)
> +		_dump_err2 "fsck.overlay failed, err=$res"
> +		;;
> +	esac
> +	return $res
> +}
> diff --git a/common/rc b/common/rc
> index cedc1cfa..d0aa36a0 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1112,8 +1112,17 @@ _repair_scratch_fs()
>  	return $res
>          ;;
>      *)
> -        # Let's hope fsck -y suffices...
> -        fsck -t $FSTYP -y $SCRATCH_DEV 2>&1
> +	local dev=$SCRATCH_DEV
> +	local fstyp=$FSTYP
> +	if [ $FSTYP = "overlay" -a -n "$OVL_BASE_SCRATCH_DEV" ]; then
> +		_repair_overlay_scratch_fs
> +		# Fall through to repair base fs
> +		dev=$OVL_BASE_SCRATCH_DEV
> +		fstyp=$OVL_BASE_FSTYP
> +		$UMOUNT_PROG $OVL_BASE_SCRATCH_MNT
> +	fi
> +	# Let's hope fsck -y suffices...
> +	fsck -t $fstyp -y $dev 2>&1
>  	local res=$?
>  	case $res in
>  	$FSCK_OK|$FSCK_NONDESTRUCT|$FSCK_REBOOT)
> 

It seems that maybe better to return the error code if one of the two repairs
failed. But the $res is not used now, so it's not a big deal.

Reviewed-by: zhangyi (F) <yi.zhang@huawei.com>

  reply	other threads:[~2019-05-29 16:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 15:17 [PATCH v3 0/4] Misc. fsck.overlay test fixes Amir Goldstein
2019-05-28 15:17 ` [PATCH v3 1/4] fstests: define constants for fsck exit codes Amir Goldstein
2019-05-29 15:57   ` zhangyi (F)
2019-05-28 15:17 ` [PATCH v3 2/4] overlay: fix _repair_scratch_fs Amir Goldstein
2019-05-29 16:10   ` zhangyi (F) [this message]
2019-05-28 15:17 ` [PATCH v3 3/4] overlay: correct fsck.overlay exit code Amir Goldstein
2019-05-29 16:13   ` zhangyi (F)
2019-06-02  7:26   ` Eryu Guan
2019-06-02  8:07     ` Amir Goldstein
2019-05-28 15:17 ` [PATCH v3 4/4] overlay: fix exit code for some fsck.overlay valid cases 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=7cf2a5b5-ab05-ecec-32ef-00c2a401aa12@huawei.com \
    --to=yi.zhang@huawei.com \
    --cc=amir73il@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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