overlay/018: test broken hardlinks after mount cycle
authorAmir Goldstein <amir73il@gmail.com>
Wed, 5 Jul 2017 12:02:02 +0000 (15:02 +0300)
committerEryu Guan <eguan@redhat.com>
Thu, 6 Jul 2017 05:38:56 +0000 (13:38 +0800)
This test checks if overlayfs hardlinks are preserved across
copy up.  Check if they are preserved also after copy up and
mount cycle.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/overlay/018
tests/overlay/018.out

index 7570a16fbaddf61b0408c6791418ec65a6f83080..46097a9342ffc625811c21cf28ec9da308f32b0f 100755 (executable)
@@ -96,11 +96,20 @@ cat $FILES
 record_ino_nlink $tmp.before
 
 # Modify content of one of the hardlinks
-echo "one" >> $foo
+# Intentionally modify the last hardlink in $FILES, so after mount cycle
+# when reading the first file in $FILES, last file won't be in inode/dcache
+echo "one" >> $bar
 
 echo "== After write one =="
 cat $FILES
-check_ino_nlink $tmp.before $tmp.after
+check_ino_nlink $tmp.before $tmp.after_one
+
+# Verify that the hardlinks survive a mount cycle
+_scratch_cycle_mount
+
+echo "== After mount cycle =="
+cat $FILES
+check_ino_nlink $tmp.after_one $tmp.after_cycle
 
 status=0
 exit
index 784e8bcfaafc512933e53c6821e247aedc27a58d..5b74ee18389f54afd5216fc25d98947083b0dfbd 100644 (file)
@@ -7,3 +7,8 @@ zero
 one
 zero
 one
+== After mount cycle ==
+zero
+one
+zero
+one