Re: [PATCH v7 7/8] ovl: update cache version of impure parent on rename

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

 



On Thu, Nov 2, 2017 at 9:38 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> ovl_rename() updates dir cache version for impure old parent if an entry
> with copy up origin is moved into old parent, but it did not update
> cache version if the entry moved out of old parent has a copy up origin.
>
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
>  fs/overlayfs/dir.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index ef533198be45..26aef3b5f007 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -1075,9 +1075,10 @@ static int ovl_rename(struct inode *olddir, struct dentry *old,
>                         drop_nlink(d_inode(new));
>         }
>
> -       ovl_dentry_version_inc(old->d_parent,
> -                              !overwrite && ovl_type_origin(new));
> +       ovl_dentry_version_inc(old->d_parent, ovl_type_origin(old));
>         ovl_dentry_version_inc(new->d_parent, ovl_type_origin(old));
> +       if (!overwrite)
> +               ovl_dentry_version_inc(old->d_parent, ovl_type_origin(new));

How about the opposite (i.e. newdir losing impurity)?  That can happen two ways:

  - overwriting copied up file (new) with pure one (old)
  - exchange copied up file (new) with pure one (old)

Also I'd merge the two version increments into one, although that
doesn't really matter:

-    ovl_dentry_version_inc(old->d_parent,
-                   !overwrite && ovl_type_origin(new));
-    ovl_dentry_version_inc(new->d_parent, ovl_type_origin(old));
+    ovl_dentry_version_inc(old->d_parent, ovl_type_origin(old) ||
+                   (!overwrite && ovl_type_origin(new)));
+    ovl_dentry_version_inc(new->d_parent,
+                   ovl_type_origin(old) || ovl_type_origin(new));

Fixed up the patch, but tell me if I'm missing something here.

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