linux/fs/overlayfs
Amir Goldstein 5f8415d6b8 ovl: persistent overlay inode nlink for indexed inodes
With inodes index enabled, an overlay inode nlink counts the union of upper
and non-covered lower hardlinks. During the lifetime of a non-pure upper
inode, the following nlink modifying operations can happen:

1. Lower hardlink copy up
2. Upper hardlink created, unlinked or renamed over
3. Lower hardlink whiteout or renamed over

For the first, copy up case, the union nlink does not change, whether the
operation succeeds or fails, but the upper inode nlink may change.
Therefore, before copy up, we store the union nlink value relative to the
lower inode nlink in the index inode xattr trusted.overlay.nlink.

For the second, upper hardlink case, the union nlink should be incremented
or decremented IFF the operation succeeds, aligned with nlink change of the
upper inode. Therefore, before link/unlink/rename, we store the union nlink
value relative to the upper inode nlink in the index inode.

For the last, lower cover up case, we simplify things by preceding the
whiteout or cover up with copy up. This makes sure that there is an index
upper inode where the nlink xattr can be stored before the copied up upper
entry is unlink.

Return the overlay inode nlinks for indexed upper inodes on stat(2).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2017-07-04 22:03:19 +02:00
..
copy_up.c ovl: persistent overlay inode nlink for indexed inodes 2017-07-04 22:03:19 +02:00
dir.c ovl: persistent overlay inode nlink for indexed inodes 2017-07-04 22:03:19 +02:00
inode.c ovl: persistent overlay inode nlink for indexed inodes 2017-07-04 22:03:19 +02:00
Kconfig ovl: introduce the inodes index dir feature 2017-07-04 22:03:17 +02:00
Makefile ovl: split super.c 2016-12-16 11:02:56 +01:00
namei.c ovl: add flag for upper in ovl_entry 2017-07-04 22:03:18 +02:00
overlayfs.h ovl: persistent overlay inode nlink for indexed inodes 2017-07-04 22:03:19 +02:00
ovl_entry.h ovl: add flag for upper in ovl_entry 2017-07-04 22:03:18 +02:00
readdir.c ovl: cleanup bad and stale index entries on mount 2017-07-04 22:03:17 +02:00
super.c ovl: add flag for upper in ovl_entry 2017-07-04 22:03:18 +02:00
util.c ovl: persistent overlay inode nlink for indexed inodes 2017-07-04 22:03:19 +02:00