Re: [PATCH v12 14/17] ovl: Set redirect on metacopy files upon rename

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

 



On Tue, Mar 6, 2018 at 10:54 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> Set redirect on metacopy files upon rename. This will help find data dentry
> in lower dirs.
>
> Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
> ---
>  fs/overlayfs/dir.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index cdeae4bdbfce..b955f6fede06 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -1048,9 +1048,11 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
>                         err = ovl_set_redirect(old, samedir);
>                 else if (!old_opaque && ovl_type_merge(new->d_parent))
>                         err = ovl_set_opaque_xerr(old, olddentry, -EXDEV);
> -               if (err)
> -                       goto out_dput;
> -       }
> +       } else if (ovl_is_metacopy_dentry(old))
> +                       err = ovl_set_redirect(old, false);

You should use {} in the else statement as well.

Q: why do you set samedir: = false here?
A: because other hardlink aliasses cannot follow a relative redirect, right?

This is a subtle detail that should be documented, but also
maybe do use samedir if nlink == 1?

> +       if (err)
> +               goto out_dput;
> +
>         if (!overwrite && new_is_dir) {
>                 if (ovl_type_merge_or_lower(new))
>                         err = ovl_set_redirect(new, samedir);
> @@ -1058,7 +1060,10 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
>                         err = ovl_set_opaque_xerr(new, newdentry, -EXDEV);
>                 if (err)
>                         goto out_dput;
> -       }
> +       } else if (!overwrite && ovl_is_metacopy_dentry(new))
> +                       err = ovl_set_redirect(new, false);

Same here for both comments.

Thanks,
Amir.
--
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