summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/export.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-12-24 18:42:16 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2018-01-24 11:26:03 +0100
commit3b0bfc6ed3c434800e5eacfb6cdbe45c07c270e1 (patch)
tree5f5920ea849e04fc4f1e6da4706621d68c09d1df /fs/overlayfs/export.c
parent9436a1a339fae84698aaa0b66d7a822018388348 (diff)
downloadlinux-3b0bfc6ed3c434800e5eacfb6cdbe45c07c270e1.tar.bz2
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: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/export.c')
-rw-r--r--fs/overlayfs/export.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index 0bca38c79244..7a4b6a0fd527 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -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) {