Re: [PATCH 3/3] fs: store fake path in file_fake along with real path

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

 



On Fri, Jun 09, 2023 at 10:32:39AM +0300, Amir Goldstein wrote:
> Instead of storing only the fake path in f_path, store the real path
> in f_path and the fake path in file_fake container.
> 
> Call sites that use the macro file_fake_path() continue to get the fake
> path from its new location.
> 
> Call sites that access f_path directly will now see the overlayfs real
> path instead of the fake overlayfs path, which is the desired bahvior
> for most users, because it makes f_path consistent with f_inode.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---

If you resend, can you take the chance and refactor this into a slightly more
readable pattern, please? So something like

struct file *open_with_fake_path(const struct path *fake_path, int flags,
                                 const struct path *path,
                                 const struct cred *cred)
{
        int error;
        struct file *f;

        f = alloc_empty_file_fake(fake_path, flags, cred);
        if (IS_ERR(f))
                return f;

        f->f_path = *path;
        error = do_dentry_open(f, d_inode(path->dentry), NULL);
        if (error) {
                fput(f);
                return ERR_PTR(error);
        }

        return f;
}



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux