aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangyi (F) <yi.zhang@huawei.com>2018-02-08 11:19:09 +0800
committerEryu Guan <eguan@redhat.com>2018-02-08 20:07:42 +0800
commitab5034f7bedae0b760204da546f9fcfd9f02a530 (patch)
tree72e714aa4189353a7910a621a2eda18c3c0cabdf
parentfe3aefba4d1704e45fe76ffbfacc75413249047f (diff)
downloadxfstests-dev-ab5034f7bedae0b760204da546f9fcfd9f02a530.tar.gz
overlay: add filesystem check helper
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> Signed-off-by: Eryu Guan <eguan@redhat.com>
-rw-r--r--common/config1
-rw-r--r--common/overlay14
2 files changed, 15 insertions, 0 deletions
diff --git a/common/config b/common/config
index 5f40413d9f..71115bdbc7 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 ad2f3be8bd..16f13a8fb0 100644
--- a/common/overlay
+++ b/common/overlay
@@ -168,3 +168,17 @@ _require_scratch_overlay_features()
_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 $*
+}