* [PATCH v2 1/2] overlay/075: fix wrong invocation of t_immutable
2021-06-06 15:18 [PATCH v2 0/2] Fixes to overlayfs immutable files tests Amir Goldstein
@ 2021-06-06 15:18 ` Amir Goldstein
2021-06-06 15:18 ` [PATCH v2 2/2] overlay/075: add test coverage for clearing immutable/append-only flags Amir Goldstein
2021-06-06 16:00 ` [PATCH v2 0/2] Fixes to overlayfs immutable files tests Amir Goldstein
2 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2021-06-06 15:18 UTC (permalink / raw)
To: Eryu Guan; +Cc: Miklos Szeredi, linux-unionfs, fstests
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@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] overlay/075: add test coverage for clearing immutable/append-only flags
2021-06-06 15:18 [PATCH v2 0/2] Fixes to overlayfs immutable files tests Amir Goldstein
2021-06-06 15:18 ` [PATCH v2 1/2] overlay/075: fix wrong invocation of t_immutable Amir Goldstein
@ 2021-06-06 15:18 ` Amir Goldstein
2021-06-06 16:00 ` [PATCH v2 0/2] Fixes to overlayfs immutable files tests Amir Goldstein
2 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2021-06-06 15:18 UTC (permalink / raw)
To: Eryu Guan; +Cc: Miklos Szeredi, linux-unionfs, fstests
overlay/075 is a variant of check -overlay generic/079.
check -overlay generic/079 does the following operations on overlay fs:
1. Create files
2. Set immutable/append-only flags
3. Verify files/dirs behaving as immutable/append-only
4. Clear immutable/append-only flags
5. Remove files
overlay/075 performs steps 1,2,4,5 on upper and lower layers
and only step 3 is performed on overlay fs (before and after copy up
and mount cycle).
Add also steps 4,5 to be performed on overlay fs to increase the
test coverage of the "merged" inode xflags feature.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/overlay/075 | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/overlay/075 b/tests/overlay/075
index 02df1599..f05858b3 100755
--- a/tests/overlay/075
+++ b/tests/overlay/075
@@ -69,6 +69,8 @@ _scratch_mount
# Test immutability of files in overlay before copy up
echo "Before directories copy up"
$timmutable $SCRATCH_MNT/testdir.before 2>&1
+# Remove the immutable/append-only flags before mount cycle
+$timmutable -R $SCRATCH_MNT/testdir.before &> /dev/null
# 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
@@ -88,9 +90,18 @@ done
# After mount cycle, flags are forever lost
_scratch_cycle_mount
+# Verify that files can be deleted from overlay fs after clearing
+# immutable/append-only flags and mount cycle
+rm -rf $SCRATCH_MNT/testdir.before
+
# Test immutability of files in overlay after directories copy-up
echo "After directories copy up"
$timmutable $SCRATCH_MNT/testdir 2>&1
+# Verify that files can be deleted from overlay fs after clearing
+# immutable/append-only flags
+$timmutable -R $SCRATCH_MNT/testdir &> /dev/null
+rm -rf $SCRATCH_MNT/testdir
+
status=$?
exit
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] Fixes to overlayfs immutable files tests
2021-06-06 15:18 [PATCH v2 0/2] Fixes to overlayfs immutable files tests Amir Goldstein
2021-06-06 15:18 ` [PATCH v2 1/2] overlay/075: fix wrong invocation of t_immutable Amir Goldstein
2021-06-06 15:18 ` [PATCH v2 2/2] overlay/075: add test coverage for clearing immutable/append-only flags Amir Goldstein
@ 2021-06-06 16:00 ` Amir Goldstein
2 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2021-06-06 16:00 UTC (permalink / raw)
To: Eryu Guan; +Cc: Miklos Szeredi, overlayfs, fstests
On Sun, Jun 6, 2021 at 6:18 PM Amir Goldstein <amir73il@gmail.com> wrote:
>
> Eryu,
>
> Test overlay/075 was written and merged to track a known overlayfs issue
> which exists in current upstream.
>
> The introduction of fileattr operations in kernel v5.13-rc1 by Miklos
> has paved the way for the fix patch that I recently posted [1].
>
> Patch #1 fixes a test bug that was hiding behind the known issue in
> upstream kernel.
Oh, you already merged this one. Great.
There is no change from v1 to v2, so you may ignore it and review
patch #2 for next week.
Thanks,
Amir.
>
> Patch #2 add test coverage to part of the kernel fix patch that is not
> covered by the current test.
>
> Thanks,
> Amir.
>
> [1] https://lore.kernel.org/linux-unionfs/20210606144641.419138-1-amir73il@gmail.com/
>
> Amir Goldstein (2):
> overlay/075: fix wrong invocation of t_immutable
> overlay/075: add test coverage for clearing immutable/append-only
> flags
>
> tests/overlay/075 | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread