* [PATCH 1/2] overlay/038: code cleanup
@ 2017-11-20 14:34 Chandan Rajendra
2017-11-20 14:34 ` [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs Chandan Rajendra
2017-11-21 6:33 ` [PATCH 1/2] overlay/038: code cleanup Amir Goldstein
0 siblings, 2 replies; 5+ messages in thread
From: Chandan Rajendra @ 2017-11-20 14:34 UTC (permalink / raw
To: fstests, amir73il; +Cc: Chandan Rajendra, linux-unionfs, eguan
This commit implements similar changes made to overlay/041 test i.e.
- Remove duplicate merged dir tests
- Remove duplicate pure upper dir inside merged dir tests
- Sort out comments and error messages
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
tests/overlay/038 | 66 +++++++++++++++++++++++--------------------------------
1 file changed, 27 insertions(+), 39 deletions(-)
diff --git a/tests/overlay/038 b/tests/overlay/038
index 28c9c4e..fd804c4 100755
--- a/tests/overlay/038
+++ b/tests/overlay/038
@@ -59,32 +59,13 @@ upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
mkdir -p $lowerdir
-mkdir $lowerdir/test_dir/
-mkdir $lowerdir/test_dir/pure_lower_dir
-mkdir $lowerdir/test_dir/merged_dir
+mkdir -p $lowerdir/test_dir/pure_lower_dir
touch $lowerdir/test_file
_scratch_mount
test_dir=$SCRATCH_MNT/test_dir/
-merged_dir=$test_dir/merged_dir
-pure_upper_dir=$merged_dir/pure_upper_dir
-
-mkdir -p $pure_upper_dir
-
-merged_dir_st_ino=$(stat -c '%i' $merged_dir)
-
-# Pure dir's parent d_ino must always be calculated because
-# it can be residing inside a merged dir.
-parent_d=$($here/src/t_dir_type $pure_upper_dir $merged_dir_st_ino)
-[[ $parent_d == ".. d" ]] || \
- echo "Pure dir inside a merged dir: Invalid d_ino reported for .."
-
-# d_ino for "." must always be calculated because the present
-# directory can have a copy-up origin.
-current_d=$($here/src/t_dir_type $merged_dir $merged_dir_st_ino)
-[[ $current_d == ". d" ]] || echo "Merged dir: Invalid d_ino reported for ."
# Verify d_ino of '.' and '..' before and after dir becomes impure.
impure_dir=$test_dir/impure_dir
@@ -96,12 +77,13 @@ impure_dir_parent_st_ino=$(stat -c '%i' $test_dir)
# Before $impure_dir becomes impure
parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino)
[[ $parent_d == ".. d" ]] || \
- echo "Before dir becomes impure: Invalid d_ino reported for .."
+ echo "Pure upper dir: Invalid d_ino reported for .."
current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino)
[[ $current_d == ". d" ]] || \
- echo "Before dir becomes impure: Invalid d_ino reported for ."
+ echo "Pure upper dir: Invalid d_ino reported for ."
+# Move a copied up file into pure dir to make it impure
mv $SCRATCH_MNT/test_file $impure_dir
test_file_st_ino=$(stat -c '%i' $impure_dir/test_file)
@@ -112,11 +94,11 @@ impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impur
# After $impure_dir becomes impure
parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino)
[[ $parent_d == ".. d" ]] || \
- echo "After dir becomes impure: Invalid d_ino reported for .."
+ echo "Impure dir: Invalid d_ino reported for .."
current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino)
[[ $current_d == ". d" ]] || \
- echo "After dir becomes impure: Invalid d_ino reported for ."
+ echo "Impure dir: Invalid d_ino reported for ."
# Verify copy up file's d_ino
file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino)
@@ -128,30 +110,35 @@ rm -rf $impure_dir/test_file
# Verify invalidation of readdir cache
$here/src/t_dir_type $impure_dir $test_file_st_ino
-[[ $? != 0 ]] || echo "Directory's readdir cache has stale entries"
+[[ $? != 0 ]] || echo "Directory's readdir cache has stale file entries"
impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impure' \
$upperdir/test_dir/impure_dir 2>/dev/null)
[[ -z $impure ]] || echo "Pure directory has impure xattr"
-# Verify d_ino values corresponding to "." and ".." entries of a
-# pure lower dir.
-parent_st_ino=$(stat -c '%i' $SCRATCH_MNT/test_dir)
+# Verify d_ino of '.' and '..' before and after dir becomes merge dir.
+parent_st_ino=$(stat -c '%i' $test_dir)
pure_lower_dir=$SCRATCH_MNT/test_dir/pure_lower_dir
+pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir)
parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino)
-[[ $parent_d == ".. d" ]] || echo "Pure lower dir: Invalid d_ino reported for .."
-
-pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir)
+[[ $parent_d == ".. d" ]] || \
+ echo "Pure lower dir: Invalid d_ino reported for .."
current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino)
-[[ $current_d == ". d" ]] || echo "Pure lower dir: Invalid d_ino reported for ."
+[[ $current_d == ". d" ]] || \
+ echo "Pure lower dir: Invalid d_ino reported for ."
-# Verify d_ino of ".." entry of a merged dir.
-merged_dir=$SCRATCH_MNT/test_dir/merged_dir
+# Create a file in pure lower dir to make it a merge dir
+touch $pure_lower_dir/newfile
-parent_d=$($here/src/t_dir_type $merged_dir $parent_st_ino)
-[[ $parent_d == ".. d" ]] || echo "Merged dir: Invalid d_ino reported for .."
+parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino)
+[[ $parent_d == ".. d" ]] || \
+ echo "Merged dir: Invalid d_ino reported for .."
+
+current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino)
+[[ $current_d == ". d" ]] || \
+ echo "Merged dir: Invalid d_ino reported for ."
_scratch_unmount
@@ -177,11 +164,12 @@ mkdir -p $lowerdir/test_dir/pure_lower_dir
_overlay_scratch_mount_dirs "$middir:$lowerdir" $upperdir $workdir
# Copy up test_dir
-touch $SCRATCH_MNT/test_dir/test_file
+touch $test_dir/test_file
-test_dir_st_ino=$(stat -c '%i' $SCRATCH_MNT/test_dir)
+test_dir_st_ino=$(stat -c '%i' $test_dir)
+pure_lower_dir=$test_dir/pure_lower_dir
-parent_d=$($here/src/t_dir_type $SCRATCH_MNT/test_dir/pure_lower_dir $test_dir_st_ino)
+parent_d=$($here/src/t_dir_type $pure_lower_dir $test_dir_st_ino)
[[ $parent_d == ".. d" ]] || \
echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for .."
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs
2017-11-20 14:34 [PATCH 1/2] overlay/038: code cleanup Chandan Rajendra
@ 2017-11-20 14:34 ` Chandan Rajendra
2017-11-21 6:30 ` Amir Goldstein
2017-11-21 6:33 ` [PATCH 1/2] overlay/038: code cleanup Amir Goldstein
1 sibling, 1 reply; 5+ messages in thread
From: Chandan Rajendra @ 2017-11-20 14:34 UTC (permalink / raw
To: fstests, amir73il; +Cc: Chandan Rajendra, linux-unionfs, eguan
This commit implements similar changes made to overlay/038 test i.e. in
addition to checking consistent values of st_ino/d_ino for "." and ".."
entries, check also the values for subdir inside each tested directory
setup.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
tests/overlay/038 | 39 ++++++++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/tests/overlay/038 b/tests/overlay/038
index fd804c4..5415324 100755
--- a/tests/overlay/038
+++ b/tests/overlay/038
@@ -59,7 +59,7 @@ upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
mkdir -p $lowerdir
-mkdir -p $lowerdir/test_dir/pure_lower_dir
+mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir
touch $lowerdir/test_file
@@ -69,10 +69,11 @@ test_dir=$SCRATCH_MNT/test_dir/
# Verify d_ino of '.' and '..' before and after dir becomes impure.
impure_dir=$test_dir/impure_dir
-mkdir -p $impure_dir
+mkdir -p $impure_dir/subdir
impure_dir_st_ino=$(stat -c '%i' $impure_dir)
impure_dir_parent_st_ino=$(stat -c '%i' $test_dir)
+impure_subdir_st_ino=$(stat -c '%i' $impure_dir/subdir)
# Before $impure_dir becomes impure
parent_d=$($here/src/t_dir_type $impure_dir $impure_dir_parent_st_ino)
@@ -83,6 +84,10 @@ current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino)
[[ $current_d == ". d" ]] || \
echo "Pure upper dir: Invalid d_ino reported for ."
+subdir_d=$($here/src/t_dir_type $impure_dir $impure_subdir_st_ino)
+[[ $subdir_d == "subdir d" ]] || \
+ echo "Pure upper dir: Invalid d_ino reported for subdir"
+
# Move a copied up file into pure dir to make it impure
mv $SCRATCH_MNT/test_file $impure_dir
test_file_st_ino=$(stat -c '%i' $impure_dir/test_file)
@@ -100,6 +105,10 @@ current_d=$($here/src/t_dir_type $impure_dir $impure_dir_st_ino)
[[ $current_d == ". d" ]] || \
echo "Impure dir: Invalid d_ino reported for ."
+subdir_d=$($here/src/t_dir_type $impure_dir $impure_subdir_st_ino)
+[[ $subdir_d == "subdir d" ]] || \
+ echo "Impure dir: Invalid d_ino reported for subdir"
+
# Verify copy up file's d_ino
file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino)
[[ $file_d == "test_file f" ]] || \
@@ -107,19 +116,23 @@ file_d=$($here/src/t_dir_type $impure_dir $test_file_st_ino)
# Make $impure_dir pure
rm -rf $impure_dir/test_file
+rm -rf $impure_dir/subdir
# Verify invalidation of readdir cache
$here/src/t_dir_type $impure_dir $test_file_st_ino
[[ $? != 0 ]] || echo "Directory's readdir cache has stale file entries"
+$here/src/t_dir_type $impure_dir $impure_subdir_st_ino
+[[ $? != 0 ]] || echo "Directory's readdir cache has stale subdir entries"
impure=$($GETFATTR_PROG --absolute-names --only-values -n 'trusted.overlay.impure' \
$upperdir/test_dir/impure_dir 2>/dev/null)
[[ -z $impure ]] || echo "Pure directory has impure xattr"
-# Verify d_ino of '.' and '..' before and after dir becomes merge dir.
+# Verify d_ino values of subdir entries of a pure lower dir.
parent_st_ino=$(stat -c '%i' $test_dir)
pure_lower_dir=$SCRATCH_MNT/test_dir/pure_lower_dir
pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir)
+pure_lower_subdir_st_ino=$(stat -c '%i' $pure_lower_dir/subdir)
parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino)
[[ $parent_d == ".. d" ]] || \
@@ -129,6 +142,10 @@ current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino)
[[ $current_d == ". d" ]] || \
echo "Pure lower dir: Invalid d_ino reported for ."
+subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino)
+[[ $subdir_d == "subdir d" ]] || \
+ echo "Pure lower dir: Invalid d_ino reported for subdir"
+
# Create a file in pure lower dir to make it a merge dir
touch $pure_lower_dir/newfile
@@ -140,6 +157,10 @@ current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino)
[[ $current_d == ". d" ]] || \
echo "Merged dir: Invalid d_ino reported for ."
+subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino)
+[[ $subdir_d == "subdir d" ]] || \
+ echo "Merged dir: Invalid d_ino reported for subdir"
+
_scratch_unmount
# Verify pure lower residing in dir which has another lower layer
@@ -158,8 +179,7 @@ mkdir -p $lowerdir
mkdir -p $upperdir
mkdir -p $workdir
-mkdir -p $middir/test_dir
-mkdir -p $lowerdir/test_dir/pure_lower_dir
+mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir
_overlay_scratch_mount_dirs "$middir:$lowerdir" $upperdir $workdir
@@ -168,10 +188,19 @@ touch $test_dir/test_file
test_dir_st_ino=$(stat -c '%i' $test_dir)
pure_lower_dir=$test_dir/pure_lower_dir
+pure_lower_dir_st_ino=$(stat -c '%i' $pure_lower_dir)
+pure_lower_subdir_st_ino=$(stat -c '%i' $pure_lower_dir/subdir)
parent_d=$($here/src/t_dir_type $pure_lower_dir $test_dir_st_ino)
[[ $parent_d == ".. d" ]] || \
echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for .."
+current_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_dir_st_ino)
+[[ $current_d == ". d" ]] || \
+ echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for ."
+
+subdir_d=$($here/src/t_dir_type $pure_lower_dir $pure_lower_subdir_st_ino)
+[[ $subdir_d == "subdir d" ]] || \
+ echo "Pure lower in dir which has another lower layer: Invalid d_ino reported for subdir"
echo "Silence is golden"
status=0
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs
2017-11-20 14:34 ` [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs Chandan Rajendra
@ 2017-11-21 6:30 ` Amir Goldstein
0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2017-11-21 6:30 UTC (permalink / raw
To: Chandan Rajendra; +Cc: fstests, overlayfs, Eryu Guan
On Mon, Nov 20, 2017 at 4:34 PM, Chandan Rajendra
<chandan@linux.vnet.ibm.com> wrote:
> This commit implements similar changes made to overlay/038 test i.e. in
> addition to checking consistent values of st_ino/d_ino for "." and ".."
> entries, check also the values for subdir inside each tested directory
> setup.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Lokks good and tested.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] overlay/038: code cleanup
2017-11-20 14:34 [PATCH 1/2] overlay/038: code cleanup Chandan Rajendra
2017-11-20 14:34 ` [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs Chandan Rajendra
@ 2017-11-21 6:33 ` Amir Goldstein
2017-11-21 7:18 ` Eryu Guan
1 sibling, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2017-11-21 6:33 UTC (permalink / raw
To: Chandan Rajendra; +Cc: fstests, overlayfs, Eryu Guan
On Mon, Nov 20, 2017 at 4:34 PM, Chandan Rajendra
<chandan@linux.vnet.ibm.com> wrote:
> This commit implements similar changes made to overlay/041 test i.e.
> - Remove duplicate merged dir tests
> - Remove duplicate pure upper dir inside merged dir tests
> - Sort out comments and error messages
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Looks good and tested.
Nit: one trailing whitespace in this patch.
Applying: overlay/038: code cleanup
.git/rebase-apply/patch:114: trailing whitespace.
warning: 1 line adds whitespace errors.
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] overlay/038: code cleanup
2017-11-21 6:33 ` [PATCH 1/2] overlay/038: code cleanup Amir Goldstein
@ 2017-11-21 7:18 ` Eryu Guan
0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2017-11-21 7:18 UTC (permalink / raw
To: Amir Goldstein; +Cc: Chandan Rajendra, fstests, overlayfs
On Tue, Nov 21, 2017 at 08:33:53AM +0200, Amir Goldstein wrote:
> On Mon, Nov 20, 2017 at 4:34 PM, Chandan Rajendra
> <chandan@linux.vnet.ibm.com> wrote:
> > This commit implements similar changes made to overlay/041 test i.e.
> > - Remove duplicate merged dir tests
> > - Remove duplicate pure upper dir inside merged dir tests
> > - Sort out comments and error messages
> >
> > Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
>
> Looks good and tested.
>
> Nit: one trailing whitespace in this patch.
> Applying: overlay/038: code cleanup
> .git/rebase-apply/patch:114: trailing whitespace.
>
> warning: 1 line adds whitespace errors.
I can fix that up on commit. Thanks for the review!
Eryu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-21 7:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 14:34 [PATCH 1/2] overlay/038: code cleanup Chandan Rajendra
2017-11-20 14:34 ` [PATCH 2/2] overlay/038: test consistent values of st_ino/d_ino for subdirs Chandan Rajendra
2017-11-21 6:30 ` Amir Goldstein
2017-11-21 6:33 ` [PATCH 1/2] overlay/038: code cleanup Amir Goldstein
2017-11-21 7:18 ` Eryu Guan
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.