More nonsamefs d_ino test cleanups
cover More nonsamefs d_ino test cleanups
Chandan,
Please review my cleanups to overlay/041.
I hope I did not "cleanup" anything important.
This is the version of the test I used for testing xino feature, because it has improved test coverage for subdirs d_ino.
If you approve of these changes, at least first 2 patches should be applied to the samefs test flavor (overlay/038), so the flavor difference remains only the layers setup used by the test.
Let me know if you want me to apply the changes to 038 myself or if you intend to do that yourself.
Thanks,
Amir.
Amir Goldstein (3):
overlay/041: code cleanup
overlay/041: test consistent values of st_ino/d_ino for subdirs overlay/041: use user defined overlay mount option
tests/overlay/041 | 106 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 43 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 overlay/041: code cleanup
- Remove duplicate merged dir tests
- Remove duplicate pure upper dir inside merged dir tests
- Sort out comments and error messages
--- tests/overlay/041 | 67 ++++++++++++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 40 deletions(-)
tests/overlay/041 +27 -40
@@ -60,9 +60,7 @@ rm -rf $lowerdir mkdir $lowerdir # Create our test files. -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_mkfs
@@ -73,23 +71,6 @@ workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK _overlay_scratch_mount_dirs $lowerdir $upperdir $workdir 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
@@ -101,13 +82,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)
@@ -118,11 +99,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)
@@ -134,30 +115,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 ." + +# Create a file in pure lower dir to make it a merge dir +touch $pure_lower_dir/newfile -# Verify d_ino of ".." entry of a merged dir. -merged_dir=$SCRATCH_MNT/test_dir/merged_dir +parent_d=$($here/src/t_dir_type $pure_lower_dir $parent_st_ino) +[[ $parent_d == ".. d" ]] || \ + echo "Merged dir: Invalid d_ino reported for .." -parent_d=$($here/src/t_dir_type $merged_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
@@ -180,11 +166,12 @@ workdir=$OVL_BASE_SCRATCH_MNT/ovl-work _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 .."
Signature · 1 line
2.7.4
PATCH 2/3 overlay/041: test consistent values of st_ino/d_ino for subdirs
In reply to Amir GoldsteinIn addition to checking consistent values of st_ino/d_ino for "." and ".." entries, check also the values for subdir inside each tested directory setup.
--- tests/overlay/041 | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-)
tests/overlay/041 +35 -4
@@ -60,7 +60,7 @@ rm -rf $lowerdir mkdir $lowerdir # Create our test files. -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir touch $lowerdir/test_file _scratch_mkfs
@@ -74,10 +74,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)
@@ -88,6 +89,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)
@@ -105,6 +110,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" ]] || \
@@ -112,19 +121,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" ]] || \
@@ -134,6 +147,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
@@ -145,6 +162,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
@@ -156,7 +177,7 @@ mkdir $middir mkdir $lowerdir mkdir -p $middir/test_dir -mkdir -p $lowerdir/test_dir/pure_lower_dir +mkdir -p $lowerdir/test_dir/pure_lower_dir/subdir _scratch_mkfs
@@ -170,11 +191,21 @@ 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 exit
Signature · 1 line
2.7.4
PATCH 3/3 overlay/041: use user defined overlay mount option
In reply to Amir GoldsteinMount non-samefs dirs with OVERLAY_MOUNT_OPTIONS, so user can opt-in for constant inode numbers on non-samefs setup (i.e. -o xino) when it is implemented.
--- tests/overlay/041 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tests/overlay/041 +4 -2
@@ -68,7 +68,8 @@ _scratch_mkfs upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK -_overlay_scratch_mount_dirs $lowerdir $upperdir $workdir +_overlay_scratch_mount_dirs $lowerdir $upperdir $workdir \ + $OVERLAY_MOUNT_OPTIONS test_dir=$SCRATCH_MNT/test_dir/
@@ -184,7 +185,8 @@ _scratch_mkfs upperdir=$OVL_BASE_SCRATCH_MNT/ovl-upper workdir=$OVL_BASE_SCRATCH_MNT/ovl-work -_overlay_scratch_mount_dirs $middir:$lowerdir $upperdir $workdir +_overlay_scratch_mount_dirs $middir:$lowerdir $upperdir $workdir \ + $OVERLAY_MOUNT_OPTIONS # Copy up test_dir touch $test_dir/test_file
Signature · 1 line
2.7.4
Quoted 7 lines · IST Amir Goldstein
Chandan,
Please review my cleanups to overlay/041.
I hope I did not "cleanup" anything important.
This is the version of the test I used for testing xino feature, because it has improved test coverage for subdirsd_ino.
The changes looks good.
Quoted 6 lines
If you approve of these changes, at least first 2 patches should be applied to the samefs test flavor (overlay/038), so the flavor difference remains only the layers setup used by the test.
Let me know if you want me to apply the changes to 038 myself or if you intend to do that yourself.
Amir, I will make the changes to overlay/038 and post them soon.
Signature · 1 line
chandan