Re: [QUESTION] Why overlayfs cannot mounted as nfs_export and metacopy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 07, 2021 at 07:37:00PM +0300, Amir Goldstein wrote:
> On Sat, Aug 7, 2021 at 2:05 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> >
> > On Sat, Aug 7, 2021 at 1:17 PM Zhihao Cheng <chengzhihao1@xxxxxxxxxx> wrote:
> > >
> > > Hi, all.
> > >
> > > As title said. I wonder to know the reason for overlayfs mount failure
> > > with '-o nfs_export=on,metacopy=on'.
> > >
> > > I modified kernel to enable these two options 'on',  it looks like that
> > > overlayfs can still work fine under nfs_v4.
> > >
> > > Besides, I can get no more information about the reason from source
> > > code, maybe I missed something.
> > >
> >
> > It's because ovl_obtain_alias() (decoding a disconnected non-dir file handle)
> > does not know how to construct a metacopy overlayfs inode.
> >
> > Maybe Vivek will be able to point you to the discussion that lead to making
> > the features mutually exclusive.
> >
> > I don't remember any other reason.
> >
> 
> I remembered some more details...
> 
> I think the main complication discussed w.r.t decoding a metacopy
> inode was for the case where ovl_inode_lowerdata() differs from
> ovl_inode_lower().
> 
> If we had a weaker variant of metacopy (e.g. metacopy=upper) that
> only allows creating and following metacopy inodes in the upper layer,
> it would have been simpler to implement ovl_obtain_alias().
> 
> Specifically, when ofs->numlayer == 2 (single lower layer), there can
> be no valid metacopy inodes in the lower layer, so that configuration
> should also be rather easy to support.

Hi Amir,

/me does not understand well the notion of disconnected dentries and
 how nfs export stuff works. So please bear with my stupid questions.

I am wondering why a lower inode can't be metacopy inode. For the
normal lookup case, we can lookup in all lower layers and figure out
which is actual data inode and which inodes are metacopy inodes. 

For the case of disconnected dentry, we probably can't do lookup. So
are calling underlying filesystem to decode. (Using origin?). If yes,
will intermediate lower not have origin xattr which we can use
to follow the complete lower chain and reconstruct all real lower
dentries and use lower data dentry and latest lower meatacopy dentry
(in the same way we do as for lookup).

Thanks
Vivek

> 
> Basically, for ovl_obtain_alias():
> - 'lowerpath' must not have metadata xattr
> - 'upper_alias' must not have metadata xattr
> - If 'index' has metacopy xattr, OVL_UPPERDATA flag
>   should not be set on ovl inode
> 
> But there are bigger complications w.r.t disconnected dentry.
> Overlayfs knows how to decode, work with and copy up
> disconnected dentries (parent is unknown), but in ovl_link(old, ...),
> 'old' dentry must not be a disconnected metacopy dentry when
> calling ovl_set_link_redirect() => ... ovl_get_redirect(), so we will
> also need to:
> - On copy up of a disconnected lower, do not use metacopy
> - Copy up data before ovl_link() when nfs_export is enabled
> - In ovl_obtain_alias(), if 'index' has redirect:
> -- Verify that it is an absolute path that it is resolved to the
> 'lowerpath's inode
> -- oip.redirect needs to be passed to ovl_get_inode()
> -- ovl_verify_inode() needs to verify that oip.redirect matches
>    redirect that is found on existing ovl inode
> 
> And probably other things that I am forgetting...
> 
> Thanks,
> Amir.
> 




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux