Re: [PATCH 2/7] ovl: no direct iteration for dir with copy up origin

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

 



On Tue, Oct 17, 2017 at 5:23 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> If a non-merge dir in an overlay mount has an overlay.origin xattr, it
> means it was once an upper merge dir, which may contain whiteouts and
> then the lower dir was removed under it.
>
> Do not iterate real dir directly in this case to avoid exposing whiteouts.
>
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
>  fs/overlayfs/readdir.c | 29 +++++++++++++++++++++++++----
>  1 file changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
> index 55623b6635b6..ba44546ad1ed 100644
> --- a/fs/overlayfs/readdir.c
> +++ b/fs/overlayfs/readdir.c
> @@ -319,21 +319,42 @@ static inline int ovl_dir_read(struct path *realpath,
>         return err;
>  }
>
> +/* Can we iterate real dir directly? */
> +static bool ovl_dir_is_real(struct dentry *dir)
> +{
> +       struct path realpath;
> +       enum ovl_path_type type = ovl_path_real(dir, &realpath);
> +
> +       if (OVL_TYPE_MERGE(type))
> +               return false;
> +
> +       /*
> +        * Non-merge dir may contain whiteouts from a time it was a merge
> +        * upper, before lower dir was removed under it and possibly before
> +        * it was rotated from upper to lower layer.
> +        */
> +       return !ovl_check_origin_xattr(realpath.dentry);

This patch is okay, but I started wondering if
ovl_check_origin_xattr() should cache the "has origin" bit for
directories.   Can be a followup patch, or we can leave it later.
Just thought I'd mention it as something to think about.

Thanks,
Miklos
--
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



[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