On Mon, May 1, 2017 at 4:41 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > Sometimes it is interesting to know if an upper file is pure > upper or a copy up target, and if it is a copy up target, it > may be interesting to find the copy up origin. > > This will be used to preserve lower inode numbers across copy up. > > Store the lower inode file handle in upper inode extended attribute > overlay.origin on copy up to use it later for these cases. > Store the lower filesystem uuid along side the file handle, so we can > validate that we are looking for the origin file in the original fs. > > On failure to encode lower file handle, store an invalid 'null' handle, > so we can always use the overlay.origin xattr to distinguish between > a copy up and a pure upper inode. > > If lower fs does not support NFS export ops or if not all layers are > on the same fs, don't try to encode a lower file handle and store the > 'null' handle instead. > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- [...] > @@ -316,6 +417,14 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, > if (err) > goto out_cleanup; > > + /* > + * Store identifier of lower inode in upper inode xattr to > + * allow lookup of the copy up origin inode. > + */ > + err = ovl_set_origin(dentry, temp); calls setxattr - should be inside the temp->d_inode code block > + if (err) > + goto out_cleanup; > +