On Wed, Jun 14, 2017 at 10:26 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > With inodes index feature, all lower and upper hardlinks point to > the same overlay inode. However, when a lower hardlink is accessed > for read operation, the real inode operated on is not the same inode > as the real inode for read operation on an upper hardlink. > > When lookup finds a lower hardlink, which is already indexed by > an earlier upper hardlink copy up, call ovl_copy_up() to link the > indexed upper on top of the lower hardlink and then operate on the > upper real inode to avoid this inconsistency. > > Invalidate a lower indexed dentry on dcache lookup, so ovl_lookup() > is called to perform the index link up. > > The following test demonstrates the upper/lower hardlinks inconsistency: > > $ echo -n a > /lower/foo > $ ln /lower/foo /lower/bar > $ cd /mnt > $ echo -n b >> foo > $ tail foo bar # foo is indexed upper, bar is indexed lower > ==> foo <== > ab > ==> bar <== > a > > $ echo -n c >> bar > $ tail foo bar # both aliases are indexed upper > ==> foo <== > abc > ==> bar <== > abc > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- > fs/overlayfs/namei.c | 11 ++++++++++- > fs/overlayfs/super.c | 32 +++++++++++++++++++++++++++----- > 2 files changed, 37 insertions(+), 6 deletions(-) > > + > +static const struct dentry_operations ovl_dentry_operations = { > + .d_release = ovl_dentry_release, > + .d_real = ovl_d_real, > + .d_revalidate = ovl_dentry_indexed_revalidate, > +}; > + > static int ovl_dentry_revalidate(struct dentry *dentry, unsigned int flags) > { ovl_dentry_indexed_revalidate() should also be checked within this variant. Will fix for next posting. -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html