public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: "zhangyi (F)" <yi.zhang@huawei.com>
To: eguan@redhat.com, fstests@vger.kernel.org
Cc: linux-unionfs@vger.kernel.org, miklos@szeredi.hu,
	amir73il@gmail.com, yi.zhang@huawei.com, miaoxie@huawei.com,
	yangerkun@huawei.com
Subject: [xfstests PATCH v2 1/4] overlay: add filesystem check helper
Date: Wed, 31 Jan 2018 18:26:01 +0800	[thread overview]
Message-ID: <20180131102604.40701-2-yi.zhang@huawei.com> (raw)
In-Reply-To: <20180131102604.40701-1-yi.zhang@huawei.com>

Add filesystem check helper for the upcoming fsck.overlay utility.
This helper invoke fsck.overlay to check and optionally repair
underlying directories of overlay filesystem.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
---
 common/config  |  1 +
 common/overlay | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/common/config b/common/config
index 5f40413..71115bd 100644
--- a/common/config
+++ b/common/config
@@ -236,6 +236,7 @@ case "$HOSTOS" in
         export MKFS_REISER4_PROG="`set_prog_path mkfs.reiser4`"
 	export E2FSCK_PROG="`set_prog_path e2fsck`"
 	export TUNE2FS_PROG="`set_prog_path tune2fs`"
+	export FSCK_OVERLAY_PROG="`set_prog_path fsck.overlay`"
         ;;
 esac
 
diff --git a/common/overlay b/common/overlay
index 1da4ab1..d741a7e 100644
--- a/common/overlay
+++ b/common/overlay
@@ -151,3 +151,17 @@ _require_scratch_overlay_feature()
 	        _notrun "${FSTYP} feature '${feature}' cannot be enabled on ${SCRATCH_DEV}"
 	_scratch_unmount
 }
+
+# Helper function to check underlying dirs of overlay filesystem
+_overlay_fsck_dirs()
+{
+	local lowerdir=$1
+	local upperdir=$2
+	local workdir=$3
+	shift 3
+
+	[[ ! -x "$FSCK_OVERLAY_PROG" ]] && return 0
+
+	$FSCK_OVERLAY_PROG -o lowerdir=$lowerdir -o upperdir=$upperdir \
+			   -o workdir=$workdir $*
+}
-- 
2.5.0


  parent reply	other threads:[~2018-01-31 10:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 10:26 [xfstests PATCH v2 0/4] overlay: add fsck.overlay basic tests zhangyi (F)
2018-01-31 10:25 ` Eryu Guan
2018-01-31 10:26 ` zhangyi (F) [this message]
2018-01-31 10:26 ` [xfstests PATCH v2 2/4] overlay: add fsck.overlay whiteout test zhangyi (F)
2018-02-06  4:22   ` Eryu Guan
2018-02-07  4:13     ` zhangyi (F)
2018-01-31 10:26 ` [xfstests PATCH v2 3/4] overlay: add fsck.overlay redirect directory test zhangyi (F)
2018-01-31 10:26 ` [xfstests PATCH v2 4/4] overlay: add fsck.overlay impure xattr test 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=20180131102604.40701-2-yi.zhang@huawei.com \
    --to=yi.zhang@huawei.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 \
    /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