Re: [PATCH v2] ovl: introduce new "index=nouuid" option for inodes index feature

From: Pavel Tikhomirov
Date: Thu Sep 24 2020 - 03:40:23 EST




On 9/23/20 7:36 PM, Amir Goldstein wrote:
@@ -414,7 +415,7 @@ static int ovl_check_origin(struct ovl_fs *ofs, struct dentry *upperdentry,
* Return 0 on match, -ESTALE on mismatch, < 0 on error.
*/
static int ovl_verify_fh(struct dentry *dentry, const char *name,
- const struct ovl_fh *fh)
+ const struct ovl_fh *fh, bool nouuid)
{
struct ovl_fh *ofh = ovl_get_fh(dentry, name);
int err = 0;
@@ -425,8 +426,14 @@ static int ovl_verify_fh(struct dentry *dentry, const char *name,
if (IS_ERR(ofh))
return PTR_ERR(ofh);

- if (fh->fb.len != ofh->fb.len || memcmp(&fh->fb, &ofh->fb, fh->fb.len))
+ if (fh->fb.len != ofh->fb.len) {
err = -ESTALE;
+ } else {
+ if (nouuid && !uuid_equal(&fh->fb.uuid, &ofh->fb.uuid))
+ ofh->fb.uuid = fh->fb.uuid;
+ if (memcmp(&fh->fb, &ofh->fb, fh->fb.len))
+ err = -ESTALE;
+ }


On second thought I am wondering if we should do that differently.
If users want to work with index=nouuid, they need to work with it from day 1.
index=nouuid should export null uuid in NFS handles and write null uuid
in trusted.overlay.origin xattr.

So in ovl_encode_real_fh() you set null uuid and
instead of relaxing uuid_equal() in ovl_decode_real_fh()
you change it to uuid_is_null().

Do you have a problem with that for Virtuozzo use case?

Actually we've enabled index=on by default in kernel config in Virtuozzo only in the new update which is not yet released. So probably we can switch to index=nouuid with null uuid in fh.


Thanks,
Amir.


--
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.