[SRU][Zesty][PATCH 03/10] ovl: use an auxiliary var for overlay root entry

Daniel Axtens daniel.axtens at canonical.com
Mon Oct 30 06:53:24 UTC 2017


From: Amir Goldstein <amir73il at gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1728489

Signed-off-by: Amir Goldstein <amir73il at gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi at redhat.com>
(cherry picked from commit c22205d0584bc65cfc9a65db0e15a9b69f5cdf64)
Signed-off-by: Daniel Axtens <daniel.axtens at canonical.com>

---
(There's no description in the upstream commit either.)
---
 fs/overlayfs/namei.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 023bb0b03352..42a98e21cf41 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -219,6 +219,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
 	const struct cred *old_cred;
 	struct ovl_fs *ofs = dentry->d_sb->s_fs_info;
 	struct ovl_entry *poe = dentry->d_parent->d_fsdata;
+	struct ovl_entry *roe = dentry->d_sb->s_root->d_fsdata;
 	struct path *stack = NULL;
 	struct dentry *upperdir, *upperdentry = NULL;
 	unsigned int ctr = 0;
@@ -258,7 +259,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
 			if (!upperredirect)
 				goto out_put_upper;
 			if (d.redirect[0] == '/')
-				poe = dentry->d_sb->s_root->d_fsdata;
+				poe = roe;
 		}
 		upperopaque = d.opaque;
 	}
@@ -289,10 +290,8 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
 		if (d.stop)
 			break;
 
-		if (d.redirect &&
-		    d.redirect[0] == '/' &&
-		    poe != dentry->d_sb->s_root->d_fsdata) {
-			poe = dentry->d_sb->s_root->d_fsdata;
+		if (d.redirect && d.redirect[0] == '/' && poe != roe) {
+			poe = roe;
 
 			/* Find the current layer on the root dentry */
 			for (i = 0; i < poe->numlower; i++)
-- 
2.11.0





More information about the kernel-team mailing list