aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-12-24 11:42:16 -0500
committerMiklos Szeredi <mszeredi@redhat.com>2018-01-24 05:26:03 -0500
commit3b0bfc6ed3c434800e5eacfb6cdbe45c07c270e1 (patch)
tree5f5920ea849e04fc4f1e6da4706621d68c09d1df /fs
parent9436a1a339fae84698aaa0b66d7a822018388348 (diff)
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')
-rw-r--r--fs/overlayfs/export.c13
-rw-r--r--fs/overlayfs/namei.c2
-rw-r--r--fs/overlayfs/overlayfs.h1
3 files changed, 15 insertions, 1 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,
461 } 461 }
462 } 462 }
463 463
464 /* Then try to get upper dir by index */
465 if (index && d_is_dir(index)) {
466 struct dentry *upper = ovl_index_upper(ofs, index);
467
468 err = PTR_ERR(upper);
469 if (IS_ERR_OR_NULL(upper))
470 goto out_err;
471
472 dentry = ovl_get_dentry(sb, upper, NULL, NULL);
473 dput(upper);
474 goto out;
475 }
476
464 /* Then lookup origin by fh */ 477 /* Then lookup origin by fh */
465 err = ovl_check_origin_fh(ofs, fh, NULL, &stack); 478 err = ovl_check_origin_fh(ofs, fh, NULL, &stack);
466 if (err) { 479 if (err) {
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 741a42d974a3..6199bf7a77c7 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -439,7 +439,7 @@ fail:
439} 439}
440 440
441/* Get upper dentry from index */ 441/* Get upper dentry from index */
442static struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index) 442struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
443{ 443{
444 struct ovl_fh *fh; 444 struct ovl_fh *fh;
445 struct dentry *upper; 445 struct dentry *upper;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index a47f9142b6be..a5d415aec131 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -270,6 +270,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh,
270 struct dentry *upperdentry, struct ovl_path **stackp); 270 struct dentry *upperdentry, struct ovl_path **stackp);
271int ovl_verify_set_fh(struct dentry *dentry, const char *name, 271int ovl_verify_set_fh(struct dentry *dentry, const char *name,
272 struct dentry *real, bool is_upper, bool set); 272 struct dentry *real, bool is_upper, bool set);
273struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index);
273int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index); 274int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index);
274int ovl_get_index_name(struct dentry *origin, struct qstr *name); 275int ovl_get_index_name(struct dentry *origin, struct qstr *name);
275struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh); 276struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh);