summaryrefslogtreecommitdiff
path: root/fs/overlayfs/inode.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-06-21 13:46:12 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2017-07-04 22:03:19 +0200
commitcaf70cb2ba5dff85ea90f494a30075af92df13b0 (patch)
treed93982b090f4ff5f56a733e8aec083959f4a567a /fs/overlayfs/inode.c
parent5f8415d6b87ecb4ebf1bbd02c538694ebb7fb57c (diff)
ovl: cleanup orphan index entries
index entry should live only as long as there are upper or lower hardlinks. Cleanup orphan index entries on mount and when dropping the last overlay inode nlink. When about to cleanup or link up to orphan index and the index inode nlink > 1, admit that something went wrong and adjust overlay nlink to index inode nlink - 1 to prevent it from dropping below zero. This could happen when adding lower hardlinks underneath a mounted overlay and then trying to unlink them. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/inode.c')
-rw-r--r--fs/overlayfs/inode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 196a4e5450c0..69f4fc26ee39 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -510,9 +510,9 @@ int ovl_set_nlink_lower(struct dentry *dentry)
return ovl_set_nlink_common(dentry, ovl_dentry_lower(dentry), "L%+i");
}
-static unsigned int ovl_get_nlink(struct dentry *lowerdentry,
- struct dentry *upperdentry,
- unsigned int fallback)
+unsigned int ovl_get_nlink(struct dentry *lowerdentry,
+ struct dentry *upperdentry,
+ unsigned int fallback)
{
int nlink_diff;
int nlink;