From: alexl@redhat.com
To: fstests@vger.kernel.org
Cc: linux-unionfs@vger.kernel.org, amir73il@gmail.com
Subject: [PATCH 2/4] overlay/060: add test cases of follow to lowerdata
Date: Thu, 6 Jul 2023 11:50:59 +0200 [thread overview]
Message-ID: <669007608d711c1c4f6b8f835affc2660084f76c.1688634271.git.alexl@redhat.com> (raw)
In-Reply-To: <cover.1688634271.git.alexl@redhat.com>
From: Amir Goldstein <amir73il@gmail.com>
Add test coverage for following metacopy from lower layer to
lower data with absolute, relative and no redirect.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/overlay/060 | 43 ++++++++++++++++++++++++++++++++++++++-----
tests/overlay/060.out | 18 ++++++++++++++++++
2 files changed, 56 insertions(+), 5 deletions(-)
diff --git a/tests/overlay/060 b/tests/overlay/060
index 363207ba..f37755da 100755
--- a/tests/overlay/060
+++ b/tests/overlay/060
@@ -7,7 +7,7 @@
# Test metadata only copy up functionality.
#
. ./common/preamble
-_begin_fstest auto quick metacopy prealloc
+_begin_fstest auto quick metacopy redirect prealloc
# Import common functions.
. ./common/filter
@@ -123,6 +123,13 @@ mount_overlay()
_overlay_scratch_mount_dirs "$_lowerdir" $upperdir $workdir -o redirect_dir=on,index=on,metacopy=on
}
+mount_ro_overlay()
+{
+ local _lowerdir=$1
+
+ _overlay_scratch_mount_dirs "$_lowerdir" "-" "-" -o ro,redirect_dir=follow,metacopy=on
+}
+
umount_overlay()
{
$UMOUNT_PROG $SCRATCH_MNT
@@ -146,7 +153,8 @@ test_common()
check_file_size_contents $SCRATCH_MNT/$_target $_size "$_data"
check_file_blocks $SCRATCH_MNT/$_target $_blocks
- # Make sure copied up file is a metacopy file.
+ # Trigger metadata copy up and check existence of metacopy xattr.
+ chmod 400 $SCRATCH_MNT/$_target
umount_overlay
check_metacopy $upperdir/$_target "y"
check_file_size_contents $upperdir/$_target $_size ""
@@ -165,7 +173,7 @@ test_common()
create_basic_files()
{
_scratch_mkfs
- mkdir -p $lowerdir $lowerdir2 $upperdir $workdir $workdir2
+ mkdir -p $lowerdir/subdir $lowerdir2 $upperdir $workdir $workdir2
mkdir -p $upperdir/$udirname
echo "$lowerdata" > $lowerdir/$lowername
chmod 600 $lowerdir/$lowername
@@ -184,12 +192,19 @@ create_lower_link()
prepare_midlayer()
{
+ local _redirect=$1
+
_scratch_mkfs
create_basic_files
+ [ -n "$_redirect" ] && mv "$lowerdir/$lowername" "$lowerdir/$_redirect"
# Create midlayer
_overlay_scratch_mount_dirs $lowerdir $lowerdir2 $workdir2 -o redirect_dir=on,index=on,metacopy=on
- # Trigger a metacopy
- chmod 400 $SCRATCH_MNT/$lowername
+ # Trigger a metacopy with or without redirect
+ if [ -n "$_redirect" ]; then
+ mv "$SCRATCH_MNT/$_redirect" "$SCRATCH_MNT/$lowername"
+ else
+ chmod 400 $SCRATCH_MNT/$lowername
+ fi
umount_overlay
}
@@ -254,6 +269,24 @@ mount_overlay $lowerdir
mv $SCRATCH_MNT/$lowerlink $SCRATCH_MNT/$ufile
test_common $lowerdir $ufile $lowersize $lowerblocks "$lowerdata" "/$lowerlink"
+echo -e "\n== Check follow to lowerdata without redirect =="
+prepare_midlayer
+mount_ro_overlay "$lowerdir2:$lowerdir"
+test_common "$lowerdir2:$lowerdir" $lowername $lowersize $lowerblocks \
+ "$lowerdata"
+
+echo -e "\n== Check follow to lowerdata with relative redirect =="
+prepare_midlayer "$lowername.renamed"
+mount_ro_overlay "$lowerdir2:$lowerdir"
+test_common "$lowerdir2:$lowerdir" "$lowername" $lowersize $lowerblocks \
+ "$lowerdata"
+
+echo -e "\n== Check follow to lowerdata with absolute redirect =="
+prepare_midlayer "/subdir/$lowername"
+mount_ro_overlay "$lowerdir2:$lowerdir"
+test_common "$lowerdir2:$lowerdir" "$lowername" $lowersize $lowerblocks \
+ "$lowerdata"
+
# success, all done
status=0
exit
diff --git a/tests/overlay/060.out b/tests/overlay/060.out
index a4790d31..f4ce0244 100644
--- a/tests/overlay/060.out
+++ b/tests/overlay/060.out
@@ -40,3 +40,21 @@ check properties of metadata copied up file
Unmount and Mount again
check properties of metadata copied up file
check properties of data copied up file
+
+== Check follow to lowerdata without redirect ==
+check properties of metadata copied up file
+Unmount and Mount again
+check properties of metadata copied up file
+check properties of data copied up file
+
+== Check follow to lowerdata with relative redirect ==
+check properties of metadata copied up file
+Unmount and Mount again
+check properties of metadata copied up file
+check properties of data copied up file
+
+== Check follow to lowerdata with absolute redirect ==
+check properties of metadata copied up file
+Unmount and Mount again
+check properties of metadata copied up file
+check properties of data copied up file
--
2.40.1
next prev parent reply other threads:[~2023-07-06 9:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1688634271.git.alexl@redhat.com>
2023-07-06 9:50 ` [PATCH 1/4] overlay: add helper for mounting rdonly overlay alexl
2023-07-06 10:07 ` Amir Goldstein
2023-07-06 10:24 ` Alexander Larsson
2023-07-06 9:50 ` alexl [this message]
2023-07-06 10:25 ` [PATCH 2/4] overlay/060: add test cases of follow to lowerdata Alexander Larsson
2023-07-06 9:51 ` [PATCH 3/4] overlay: Add test for follow of lowerdata in data-only layers alexl
2023-07-06 9:51 ` [PATCH 4/4] overlay: Add test coverage for fs-verity support alexl
2023-07-08 1:56 ` Eric Biggers
2023-07-10 8:47 ` Alexander Larsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=669007608d711c1c4f6b8f835affc2660084f76c.1688634271.git.alexl@redhat.com \
--to=alexl@redhat.com \
--cc=amir73il@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.