Re: [PATCH 11/17] ovl: hash overlay non-dir inodes by copy up origin inode

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

 



On Fri, Jun 2, 2017 at 5:04 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> Non-dir pure upper overlay inodes are hashed by the address of the
> upper real inode.  When inodes index feature is enabled, hash all non-dir
> inodes by the address of the copy up origin inode if we know it.
>
> This is going to be used to prevent breaking lower hardlinks on copy up.
>
> Because overlay dentries of lower hardlink aliases have the same overlay
> inode, copy up of those lower aliases can result is conflict when setting
> the real upper inode of a broken hardlink. Copy up of an alias that lost
> in this conflict will return -EEXIST and drop the overlay dentry.
>
> This conflict is going to be handled more gracefully by following patches.
>
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> ---
...
>  static int ovl_inode_test(struct inode *inode, void *data)
>  {
> -       return READ_ONCE(inode->i_private) == data;
> +       void *this = READ_ONCE(inode->i_private);
> +
> +       if (this == data)
> +               return true;
> +
> +       /*
> +        * Overlay inodes hash key is the address of the lower origin inode.
> +        * Return same overlay inode when looking up by lower real inode, but
> +        * an existing overlay inode, that is hashed by the same lower origin
> +        * inode, has already been updated on copy up to a real upper inode.
> +        */
> +       return ovl_indexdir(inode->i_sb) &&
> +               ovl_inode_data_is_upper(this) &&
> +               !ovl_inode_data_is_upper(data);
>  }
>

Miklos,

FYI, the test above is completely bogus.
I used it for testing, because for small numbers of inodes hash collision
probability is low.

In v2 of the inode hash patches, I stored the origin inode in
i_data.private_data. I hope you will approve of this, if not, maybe
it's time to allocate an ovl_inode. I may have other interesting things
to store there (e.g. copyup and coverup nlink count).

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