On Thu, Nov 5, 2020 at 10:38 AM Chengguang Xu <cgxu519@xxxxxxxxxxxx> wrote: > > ---- 在 星期四, 2020-11-05 16:07:26 Amir Goldstein <amir73il@xxxxxxxxx> 撰写 ---- > > On Thu, Nov 5, 2020 at 6:39 AM Chengguang Xu <cgxu519@xxxxxxxxxxxx> wrote: > > > > > > Hello, > > > > > > I have a question about opening file of underlying filesystem in overlayfs, > > > > > > why we use overlayfs' path(vfsmount/dentry) struct for underlying fs' file > > > > > > in ovl_open_realfile()? Is it by design? > > > > Sure. open_with_fake_path() is only used by overlayfs. > > > > IIRC, one of the reasons was to display the user expected path in > > /proc/<pid>/maps. > > There may have been other reasons. > > > > So if we do the mmap with overlayfs' own page cache, then we don't have to > use pseudo path for the reason above, right? > > Actually, the background is I'm trying to implement overlayfs' page cache for > fixing mmap rorw issue. The reason why asking this is I need to open a writeback > file which is used for syncing dirty data from overlayfs' own page cache to upper inode. > However, if I use the pseudo path just like current opening behavior, the writeback > file will hold a reference of vfsmount of overlayfs and it will cause umount fail with -EBUSY. > So I want to open a writeback file with correct underlying path struct but not sure if > there is any unexpected side effect. Any suggestion? Should be no issue with plain dentry_open() for that purpose. In fact it would be really good to get rid of all that d_real*() mess completely, but that seems some ways off. Did you find the prototype we did with Amir a couple of years back? I can only find bits and pieces in my mailbox... Thanks, Miklos