aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-04-26 16:40:52 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2017-05-05 05:38:58 -0400
commitc22205d0584bc65cfc9a65db0e15a9b69f5cdf64 (patch)
tree395ac94f8c39308a49cd75b60fa6127b3ec8a166
parent3a1e819b4e80216e00ef6a4dfe67fa142450c5e1 (diff)
ovl: use an auxiliary var for overlay root entry
Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r--fs/overlayfs/namei.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index b8b077821fb0..d0a3e4ad3042 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -220,6 +220,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
220 const struct cred *old_cred; 220 const struct cred *old_cred;
221 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; 221 struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
222 struct ovl_entry *poe = dentry->d_parent->d_fsdata; 222 struct ovl_entry *poe = dentry->d_parent->d_fsdata;
223 struct ovl_entry *roe = dentry->d_sb->s_root->d_fsdata;
223 struct path *stack = NULL; 224 struct path *stack = NULL;
224 struct dentry *upperdir, *upperdentry = NULL; 225 struct dentry *upperdir, *upperdentry = NULL;
225 unsigned int ctr = 0; 226 unsigned int ctr = 0;
@@ -259,7 +260,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
259 if (!upperredirect) 260 if (!upperredirect)
260 goto out_put_upper; 261 goto out_put_upper;
261 if (d.redirect[0] == '/') 262 if (d.redirect[0] == '/')
262 poe = dentry->d_sb->s_root->d_fsdata; 263 poe = roe;
263 } 264 }
264 upperopaque = d.opaque; 265 upperopaque = d.opaque;
265 } 266 }
@@ -290,10 +291,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
290 if (d.stop) 291 if (d.stop)
291 break; 292 break;
292 293
293 if (d.redirect && 294 if (d.redirect && d.redirect[0] == '/' && poe != roe) {
294 d.redirect[0] == '/' && 295 poe = roe;
295 poe != dentry->d_sb->s_root->d_fsdata) {
296 poe = dentry->d_sb->s_root->d_fsdata;
297 296
298 /* Find the current layer on the root dentry */ 297 /* Find the current layer on the root dentry */
299 for (i = 0; i < poe->numlower; i++) 298 for (i = 0; i < poe->numlower; i++)