xfstest: overlay: Absolute redirect should be followed even if ancestor is opaque
PATCH 1/1 xfstest: overlay: Absolute redirect should be followed even if ancestor is opaque
Typically, when following absolute redirect, if an opauqe dentry is found, lookup in further lower directories is stopped. But if a child dentry has another absolute redirect, then lookup in further lower layers should continue.
Say, following is example setup.
upper: /redirect (redirect=/a/b/c) lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) lower0: /a/b/d/foo
"redirect" directory in upper should merge with lower1:/a/b/c/ and lower0:/a/b/d/, despite lower1:/a/b/ being opaque.
This example and kernel fix has come from Amir Goldstein. I am just putting a test for it to make sure its not broken down the line.
--- tests/overlay/057 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/057.out | 2 + tests/overlay/group | 1 3 files changed, 100 insertions(+)
tests/overlay/057 new file +97 -0
@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 057 +# +# Test absolute redirect is followed even if ancestor is opaque +# +# Typically, when following absolute redirect, if an opauqe dentry is +# found, lookup in further lower directories is stopped. But if a +# child dentry has another absolute redirect, then lookup in further +# lower layers should continue. +# +# Say, following is example setup. +# upper: /redirect (redirect=/a/b/c) +# lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) +# lower0: /a/b/d/foo +# +# "redirect" directory in upper should merge with lower1:/a/b/c/ and +# lower0:/a/b/d/, despite lower1:/a/b/ being opaque. +# +#----------------------------------------------------------------------- +# Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. +# Author: Vivek Goyal <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch_nocheck +_require_scratch_overlay_features redirect_dir + +# remove all files from previous tests +_scratch_mkfs + +# 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 +workdir2=$OVL_BASE_SCRATCH_MNT/workdir2 + +make_test_dirs() +{ + rm -rf $lowerdir $lowerdir2 $upperdir $workdir $workdir2 + mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir2 +} + +make_test_dirs +mkdir -p $lowerdir/origin +touch $lowerdir/origin/foo +_overlay_scratch_mount_dirs $lowerdir $lowerdir2 $workdir2 +mkdir $SCRATCH_MNT/pure +mv $SCRATCH_MNT/origin $SCRATCH_MNT/pure/redirect +$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir +mv $SCRATCH_MNT/pure/redirect $SCRATCH_MNT/redirect +$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir +ls $SCRATCH_MNT/redirect/ + +# success, all done +status=0 +exit
tests/overlay/group +1 -0
@@ -59,3 +59,4 @@ 054 auto quick copyup redirect exportfs 055 auto quick copyup redirect exportfs nonsamefs 056 auto quick fsck +057 auto quick redirect
tests/overlay/057.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 057 +foo
Quoted 10 lines · Vivek Goyal
Typically, when following absolute redirect, if an opauqe dentry is found, lookup in further lower directories is stopped. But if a child dentry has another absolute redirect, then lookup in further lower layers should continue.
Say, following is example setup.
upper: /redirect (redirect=/a/b/c) lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) lower0: /a/b/d/foo
Quoted 5 lines
"redirect" directory in upper should merge with lower1:/a/b/c/ and lower0:/a/b/d/, despite lower1:/a/b/ being opaque.
This example and kernel fix has come from Amir Goldstein. I am just putting a test for it to make sure its not broken down the line.
Thanks!!
Some nits and commentary below..
Quoted 81 lines
Signed-off-by Vivek Goyal <[email protected]>--- tests/overlay/057 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/057.out | 2 + tests/overlay/group | 1 3 files changed, 100 insertions(+)Index: xfstests-dev/tests/overlay/057
===================================================================tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +68
-0@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 057 +# +# Test absolute redirect is followed even if ancestor is opaque +# +# Typically, when following absolute redirect, if an opauqe dentry is +# found, lookup in further lower directories is stopped. But if a +# child dentry has another absolute redirect, then lookup in further +# lower layers should continue. +# +# Say, following is example setup. +# upper: /redirect (redirect=/a/b/c) +# lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) +# lower0: /a/b/d/foo +# +# "redirect" directory in upper should merge with lower1:/a/b/c/ and +# lower0:/a/b/d/, despite lower1:/a/b/ being opaque. +# +#----------------------------------------------------------------------- +# Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. +# Author: Vivek Goyal <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch_nocheck +_require_scratch_overlay_features redirect_dir + +# remove all files from previous tests +_scratch_mkfs +
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 78
Quoted 10 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +10
-0+# 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 +workdir2=$OVL_BASE_SCRATCH_MNT/workdir2 + +make_test_dirs() +{ + rm -rf $lowerdir $lowerdir2 $upperdir $workdir $workdir2
No need for rm, we are after scratch_mkfs, so not sure we need a helper here.
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 85
Quoted 7 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +7
-0+ mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir2 +} + +make_test_dirs +mkdir -p $lowerdir/origin +touch $lowerdir/origin/foo +_overlay_scratch_mount_dirs $lowerdir $lowerdir2 $workdir2
-o redirect_dir=on
# Create opaque parent with absolute redirect child in middle layer
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 89
Quoted 4 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +4
-0+mkdir $SCRATCH_MNT/pure +mv $SCRATCH_MNT/origin $SCRATCH_MNT/pure/redirect +$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir
-o redirect_dir=on
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 90
Quoted 1 line
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +1
-0+mv $SCRATCH_MNT/pure/redirect $SCRATCH_MNT/redirect
# Verify that redirects are followed after mount cycle
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 92
Quoted 2 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir
-o redirect_dir=on
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 94
Quoted 2 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+ls $SCRATCH_MNT/redirect/ +
How about _overlay_check_scratch_dirs? This maybe an interesting case for fsck.overlay as well.
Quoted 19 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +3
-0+# success, all done +status=0 +exitIndex: xfstests-dev/tests/overlay/group
===================================================================tests/overlay/group 2018-03-12 09:31:45.692818432 -0400 renamed from tests/overlay/group 2018-02-28 15:27:29.981693615 -0500 +1
-0@@ -59,3 +59,4 @@ 054 auto quick copyup redirect exportfs 055 auto quick copyup redirect exportfs nonsamefs 056 auto quick fsck +057 auto quick redirectIndex: xfstests-dev/tests/overlay/057.out
===================================================================tests/overlay/057.out 2018-03-12 13:09:42.061818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0@@ -0,0 +1,2 @@ +QA output created by 057 +foo
Quoted 14 lines · Amir Goldstein
Quoted 13 lines · Vivek Goyal
Typically, when following absolute redirect, if an opauqe dentry is found, lookup in further lower directories is stopped. But if a child dentry has another absolute redirect, then lookup in further lower layers should continue.
Say, following is example setup.
upper: /redirect (redirect=/a/b/c) lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) lower0: /a/b/d/foo"redirect" directory in upper should merge with lower1:/a/b/c/ and lower0:/a/b/d/, despite lower1:/a/b/ being opaque.
Quoted 6 lines
Quoted 2 lines
This example and kernel fix has come from Amir Goldstein. I am just putting a test for it to make sure its not broken down the line.
Thanks!!
Reviewed-by Amir Goldstein <[email protected]>
Thanks. I will capture your Reviewed-by in V2.
Quoted 88 lines
Some nits and commentary below..
Quoted 85 lines
Signed-off-by Vivek Goyal <[email protected]>--- tests/overlay/057 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/057.out | 2 + tests/overlay/group | 1 3 files changed, 100 insertions(+)Index: xfstests-dev/tests/overlay/057
===================================================================tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +72
-0@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 057 +# +# Test absolute redirect is followed even if ancestor is opaque +# +# Typically, when following absolute redirect, if an opauqe dentry is +# found, lookup in further lower directories is stopped. But if a +# child dentry has another absolute redirect, then lookup in further +# lower layers should continue. +# +# Say, following is example setup. +# upper: /redirect (redirect=/a/b/c) +# lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) +# lower0: /a/b/d/foo +# +# "redirect" directory in upper should merge with lower1:/a/b/c/ and +# lower0:/a/b/d/, despite lower1:/a/b/ being opaque. +# +#----------------------------------------------------------------------- +# Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. +# Author: Vivek Goyal <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch_nocheck +_require_scratch_overlay_features redirect_dir + +# remove all files from previous tests +_scratch_mkfs + +# Create test directories +lowerdir=$OVL_BASE_SCRATCH_MNT/lower +lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2 +upperdir=$OVL_BASE_SCRATCH_MNT/upper
Quoted 8 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 78
Quoted 6 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +6
-0+workdir=$OVL_BASE_SCRATCH_MNT/workdir +workdir2=$OVL_BASE_SCRATCH_MNT/workdir2 + +make_test_dirs() +{ + rm -rf $lowerdir $lowerdir2 $upperdir $workdir $workdir2No need for rm, we are after
scratch_mkfs, so not sure we need a helper here.
Will remove.
Quoted 10 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 85
Quoted 8 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +7
-0+ mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir2 +} + +make_test_dirs +mkdir -p $lowerdir/origin +touch $lowerdir/origin/foo +_overlay_scratch_mount_dirs $lowerdir $lowerdir2 $workdir2-o redirect_dir=on
Will fix.
Quoted 9 lines
# Create opaque parent with absolute redirect child in middle layer
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 89
Quoted 4 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +4
-0+mkdir $SCRATCH_MNT/pure +mv $SCRATCH_MNT/origin $SCRATCH_MNT/pure/redirect +$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir-o redirect_dir=on
Will fix.
Quoted 9 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 90
Quoted 2 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +1
-0+mv $SCRATCH_MNT/pure/redirect $SCRATCH_MNT/redirect# Verify that redirects are followed after mount cycle
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 92
Quoted 2 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir-o redirect_dir=on
Will fix.
Quoted 6 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 94
Quoted 3 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+ls $SCRATCH_MNT/redirect/ +How about
_overlay_check_scratch_dirs? This maybe an interesting case for fsck.overlay as well.
This does not look necessary at this point. In general I agree that running fsck makes sense. In fact probably makes sense after all the tests. But IIUC, as of now fsck.overlay is not widely available and in that case test will be skipped.
I would first rather wait for fsck.overlay to be widely available and then add this to make sure this test is not skipped.
Vivek
Quoted 20 lines
Quoted 20 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +3
-0+# success, all done +status=0 +exitIndex: xfstests-dev/tests/overlay/group
===================================================================tests/overlay/group 2018-03-12 09:31:45.692818432 -0400 renamed from tests/overlay/group 2018-02-28 15:27:29.981693615 -0500 +1
-0@@ -59,3 +59,4 @@ 054 auto quick copyup redirect exportfs 055 auto quick copyup redirect exportfs nonsamefs 056 auto quick fsck +057 auto quick redirectIndex: xfstests-dev/tests/overlay/057.out
===================================================================tests/overlay/057.out 2018-03-12 13:09:42.061818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0@@ -0,0 +1,2 @@ +QA output created by 057 +foo
Quoted 134 lines · Vivek Goyal
Quoted 14 lines · Amir Goldstein
Quoted 13 lines · Vivek Goyal
Typically, when following absolute redirect, if an opauqe dentry is found, lookup in further lower directories is stopped. But if a child dentry has another absolute redirect, then lookup in further lower layers should continue.
Say, following is example setup.
upper: /redirect (redirect=/a/b/c) lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) lower0: /a/b/d/foo"redirect" directory in upper should merge with lower1:/a/b/c/ and lower0:/a/b/d/, despite lower1:/a/b/ being opaque.
Quoted 6 lines
Quoted 2 lines
This example and kernel fix has come from Amir Goldstein. I am just putting a test for it to make sure its not broken down the line.
Thanks!!
Reviewed-by Amir Goldstein <[email protected]>Thanks. I will capture your Reviewed-by in V2.
Quoted 88 lines
Some nits and commentary below..
Quoted 85 lines
Signed-off-by Vivek Goyal <[email protected]>--- tests/overlay/057 | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/057.out | 2 + tests/overlay/group | 1 3 files changed, 100 insertions(+)Index: xfstests-dev/tests/overlay/057
===================================================================tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +72
-0@@ -0,0 +1,97 @@ +#! /bin/bash +# FS QA Test No. 057 +# +# Test absolute redirect is followed even if ancestor is opaque +# +# Typically, when following absolute redirect, if an opauqe dentry is +# found, lookup in further lower directories is stopped. But if a +# child dentry has another absolute redirect, then lookup in further +# lower layers should continue. +# +# Say, following is example setup. +# upper: /redirect (redirect=/a/b/c) +# lower1: /a/[b]/c ([b] is opaque) (c has absolute redirect=/a/b/d/) +# lower0: /a/b/d/foo +# +# "redirect" directory in upper should merge with lower1:/a/b/c/ and +# lower0:/a/b/d/, despite lower1:/a/b/ being opaque. +# +#----------------------------------------------------------------------- +# Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. +# Author: Vivek Goyal <[email protected]> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch_nocheck +_require_scratch_overlay_features redirect_dir + +# remove all files from previous tests +_scratch_mkfs + +# Create test directories +lowerdir=$OVL_BASE_SCRATCH_MNT/lower +lowerdir2=$OVL_BASE_SCRATCH_MNT/lower2 +upperdir=$OVL_BASE_SCRATCH_MNT/upperQuoted 8 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 78
Quoted 6 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +6
-0+workdir=$OVL_BASE_SCRATCH_MNT/workdir +workdir2=$OVL_BASE_SCRATCH_MNT/workdir2 + +make_test_dirs() +{ + rm -rf $lowerdir $lowerdir2 $upperdir $workdir $workdir2No need for rm, we are after
scratch_mkfs, so not sure we need a helper here.Will remove.
Quoted 10 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 85
Quoted 8 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +7
-0+ mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir2 +} + +make_test_dirs +mkdir -p $lowerdir/origin +touch $lowerdir/origin/foo +_overlay_scratch_mount_dirs $lowerdir $lowerdir2 $workdir2-o redirect_dir=on
Quoted 5 lines
Will fix.
Quoted 3 lines
# Create opaque parent with absolute redirect child in middle layer
Please add these comments to your test.
Quoted 7 lines
Quoted 6 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 89
Quoted 4 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +4
-0+mkdir $SCRATCH_MNT/pure +mv $SCRATCH_MNT/origin $SCRATCH_MNT/pure/redirect +$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir-o redirect_dir=on
Quoted 6 lines
Will fix.
Quoted 4 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 90
Quoted 2 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +1
-0+mv $SCRATCH_MNT/pure/redirect $SCRATCH_MNT/redirect# Verify that redirects are followed after mount cycle
This one as well.
Quoted 14 lines
Quoted 5 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 92
Quoted 3 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+$UMOUNT_PROG $SCRATCH_MNT +_overlay_scratch_mount_dirs $lowerdir2:$lowerdir $upperdir $workdir-o redirect_dir=on
Will fix.
Quoted 6 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 line 94
Quoted 3 lines
tests/overlay/057 2018-03-12 13:28:02.274818432 -0400 renamed from dev/null 1970-01-01 00:00:00.000000000 +0000 +2
-0+ls $SCRATCH_MNT/redirect/ +How about
_overlay_check_scratch_dirs? This maybe an interesting case for fsck.overlay as well.
Quoted 8 lines
This does not look necessary at this point. In general I agree that running fsck makes sense. In fact probably makes sense after all the tests. But IIUC, as of now fsck.overlay is not widely available and in that case test will be skipped.
I would first rather wait for fsck.overlay to be widely available and then add this to make sure this test is not skipped.
That's not how fsck.overlay intergartion behaves. Patches by Zhangyi that were recently merged will auto check overlay at _scratch_umount IFF fsck.overlay is installed.
Tests that use _overlay_scratch_mount_dirs (and not _scratch_mount) should _require_scratch_nocheck (as you did) to avoid running fsck with wrong (default) dirs, but test author should instead call _overlay_check_scratch_dirs at the end of the test with the specialized scratch dirs and mount options.
The only case where _overlay_check_scratch_dirs should NOT be called is if overlay is expected to be inconsistent see 3ba014a overlay: skip check for tests finished with corrupt filesystem
It ended up being a little confusing, but in order to avert confusion, you should add comments above _require_scratch_nocheck, see 697e465 overlay: correct scratch dirs check
Thanks,
Amir.