overlay: test dropping nlink below zero

nlink of overlay inode could be dropped indefinitely by adding
un-accounted lower hardlinks underneath a mounted overlay and
trying to remove them.

The simplest way to understand this test is this:
Imagine that you have a tool (e.g. xfs_db) with which you can add
hardlinks, without changing the value of nlink stored on-disk for
the inode. This is exactly what this test does when it adds lower
hardlinks underneath a mounted overlay.

Commit 5f8415d6b87e ("ovl: persistent overlay inode nlink for
indexed inodes") fixes this issue, although the issue was never
exposed in any released kernel.

With overlayfs indexed copy up and without the fix, the test
triggers WARN_ON(inode->i_nlink == 0) in drop_link().

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Amir Goldstein
2017-07-05 15:02:06 +03:00
committed by Eryu Guan
parent af55e91fd2
commit c7169fada6
3 changed files with 110 additions and 0 deletions
+1
View File
@@ -36,3 +36,4 @@
031 auto quick whiteout
032 auto quick copyup hardlink
033 auto quick copyup hardlink
034 auto quick copyup hardlink