t_immutable cannot be run twice on the same test directoty, because append-only directory tests create files in append-only.d and those file already exist from the first run. Use separate test directories for the first and second t_immutable runs. Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- Eryu, While working on the kernel fix, I found this test bug. Please merge this test bug fix in preparation of the kernel fix. Thanks, Amir. tests/overlay/075 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/overlay/075 b/tests/overlay/075 index 5a6c3be0..02df1599 100755 --- a/tests/overlay/075 +++ b/tests/overlay/075 @@ -30,6 +30,7 @@ _cleanup() # we just need to remove the flags so use -R $timmutable -R $upperdir/testdir &> /dev/null $timmutable -R $lowerdir/testdir &> /dev/null + $timmutable -R $lowerdir/testdir.before &> /dev/null rm -f $tmp.* } @@ -45,13 +46,16 @@ _require_scratch _scratch_mkfs -# Preparing test area files in lower dir and check chattr support of base fs +# Check chattr support of base fs mkdir -p $lowerdir mkdir -p $upperdir -$timmutable -C $lowerdir/testdir >$tmp.out 2>&1 +$timmutable -C $lowerdir/testdir.before >$tmp.out 2>&1 if grep -q -e 'Operation not supported' -e "Inappropriate ioctl" $tmp.out; then _notrun "Setting immutable/append flag not supported" fi + +# Prepare test area files in lower dir +$timmutable -C $lowerdir/testdir >$tmp.out 2>&1 # Remove the immutable/append-only flags and create subdirs $timmutable -R $lowerdir/testdir >$tmp.out 2>&1 for dir in $lowerdir/testdir/*.d; do @@ -62,9 +66,9 @@ $timmutable -C $lowerdir/testdir >$tmp.out 2>&1 _scratch_mount -# Test immutability of files in overlay +# Test immutability of files in overlay before copy up echo "Before directories copy up" -$timmutable $SCRATCH_MNT/testdir 2>&1 +$timmutable $SCRATCH_MNT/testdir.before 2>&1 # Trigger copy-up of immutable/append-only dirs by touching their subdirs # inode flags are not copied-up, so immutable/append-only flags are lost -- 2.31.1