On 2017/12/14 21:13, Amir Goldstein Wrote: > On Thu, Dec 14, 2017 at 8:48 AM, zhangyi (F) <yi.zhang@xxxxxxxxxx> wrote: >> Add fsck.overlay test case to test it how to deal with orphan/valid >> whiteouts in underlying directories of overlayfs. >> >> Signed-off-by: zhangyi (F) <yi.zhang@xxxxxxxxxx> >> --- >> tests/overlay/201 | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++ >> tests/overlay/201.out | 3 ++ >> tests/overlay/group | 1 + >> 3 files changed, 102 insertions(+) >> create mode 100755 tests/overlay/201 >> create mode 100644 tests/overlay/201.out >> [..] >> +# Create test directories >> +lowerdir=$OVL_BASE_SCRATCH_MNT/lower >> +lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2 >> +upperdir=$OVL_BASE_SCRATCH_MNT/upper >> +workdir=$OVL_BASE_SCRATCH_MNT/workdir >> + >> +mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir >> + >> +# Test orphan whiteout in lower and upper layer, should remove >> +echo "+ Orphan whiteout" >> +mknod $lowerdir/foo c 0 0 >> +mknod $upperdir/foo c 0 0 >> +mknod $upperdir/bar c 0 0 >> +_overlay_fsck_dirs -a $lowerdir $upperdir $workdir >> $seqres.full 2>&1 || \ > > Don'y you mean -p ? ;-p > Will change to use -p and elsewhere, it's easier to understand. Thanks, Yi. >> + _fail "fsck should not fail" >> +ls $lowerdir >> +ls $upperdir >> +rm -rf $lowerdir/* $upperdir/* >> + >> +# Test valid whiteout covering lower target, should not remove >> +echo "+ Valid whiteout" >> +touch $lowerdir2/foo $lowerdir2/bar >> +mknod $upperdir/foo c 0 0 >> +mknod $lowerdir/bar c 0 0 >> +_overlay_fsck_dirs -a "$lowerdir:$lowerdir2" $upperdir $workdir >> \ >> + $seqres.full 2>&1 || _fail "fsck should not fail" >> +check_whiteout $upperdir/foo >> +check_whiteout $lowerdir/bar >> + >> +# success, all done >> +status=0 >> +exit >> diff --git a/tests/overlay/201.out b/tests/overlay/201.out >> new file mode 100644 >> index 0000000..20338db >> --- /dev/null >> +++ b/tests/overlay/201.out >> @@ -0,0 +1,3 @@ >> +QA output created by 201 >> ++ Orphan whiteout >> ++ Valid whiteout >> diff --git a/tests/overlay/group b/tests/overlay/group >> index 7e541e4..7c5fcbb 100644 >> --- a/tests/overlay/group >> +++ b/tests/overlay/group >> @@ -49,3 +49,4 @@ >> 044 auto quick copyup hardlink nonsamefs >> 047 auto quick copyup hardlink >> 048 auto quick copyup hardlink >> +201 auto quick fsck >> -- > > > Looks good > > Amir. > > . > -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html