summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/namei.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2018-03-09 15:44:43 -0500
committerMiklos Szeredi <mszeredi@redhat.com>2018-04-12 06:04:49 -0400
commit102b0d11cbe83e607a8e9060c05930905332f9ec (patch)
treecd05df92289ee28d57a8ce50d71ed4be6d830b30 /fs/overlayfs/namei.c
parente9b77f90cc2307f6d2457696d3d76288a5df11fc (diff)
ovl: set d->is_dir and d->opaque for last path element
Certain properties in ovl_lookup_data should be set only for the last element of the path. IOW, if we are calling ovl_lookup_single() for an absolute redirect, then d->is_dir and d->opaque do not make much sense for intermediate path elements. Instead set them only if dentry being lookup is last path element. As of now we do not seem to be making use of d->opaque if it is set for a path/dentry in lower. But just define the semantics so that future code can make use of this assumption. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/namei.c')
-rw-r--r--fs/overlayfs/namei.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 5287c4bcf14b..0a26b76590d5 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -230,6 +230,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
230{ 230{
231 struct dentry *this; 231 struct dentry *this;
232 int err; 232 int err;
233 bool last_element = !post[0];
233 234
234 this = lookup_one_len_unlocked(name, base, namelen); 235 this = lookup_one_len_unlocked(name, base, namelen);
235 if (IS_ERR(this)) { 236 if (IS_ERR(this)) {
@@ -257,12 +258,15 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
257 goto put_and_out; 258 goto put_and_out;
258 goto out; 259 goto out;
259 } 260 }
260 d->is_dir = true; 261 if (last_element)
262 d->is_dir = true;
261 if (d->last) 263 if (d->last)
262 goto out; 264 goto out;
263 265
264 if (ovl_is_opaquedir(this)) { 266 if (ovl_is_opaquedir(this)) {
265 d->stop = d->opaque = true; 267 d->stop = true;
268 if (last_element)
269 d->opaque = true;
266 goto out; 270 goto out;
267 } 271 }
268 err = ovl_check_redirect(this, d, prelen, post); 272 err = ovl_check_redirect(this, d, prelen, post);