Commit 3b0bfc6e authored by Amir Goldstein's avatar Amir Goldstein Committed by Miklos Szeredi
Browse files

ovl: decode indexed dir file handles



Decoding an indexed dir file handle is done by looking up the file handle
in index dir by name and then decoding the upper dir from the index origin
file handle. The decoded upper path is used to lookup an overlay dentry of
the same path.

Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 9436a1a3
......@@ -461,6 +461,19 @@ static struct dentry *ovl_lower_fh_to_d(struct super_block *sb,
}
}
/* Then try to get upper dir by index */
if (index && d_is_dir(index)) {
struct dentry *upper = ovl_index_upper(ofs, index);
err = PTR_ERR(upper);
if (IS_ERR_OR_NULL(upper))
goto out_err;
dentry = ovl_get_dentry(sb, upper, NULL, NULL);
dput(upper);
goto out;
}
/* Then lookup origin by fh */
err = ovl_check_origin_fh(ofs, fh, NULL, &stack);
if (err) {
......
......@@ -439,7 +439,7 @@ fail:
}
/* Get upper dentry from index */
static struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
{
struct ovl_fh *fh;
struct dentry *upper;
......
......@@ -270,6 +270,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh,
struct dentry *upperdentry, struct ovl_path **stackp);
int ovl_verify_set_fh(struct dentry *dentry, const char *name,
struct dentry *real, bool is_upper, bool set);
struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index);
int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index);
int ovl_get_index_name(struct dentry *origin, struct qstr *name);
struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment