diff --git a/fs/wrapfs/inode.c b/fs/wrapfs/inode.c
-index ab0aff1abbd9..7adc0e7c6a2d 100644
+index ab0aff1abbd9..1424cced8bfc 100644
--- a/fs/wrapfs/inode.c
+++ b/fs/wrapfs/inode.c
@@ -8,8 +8,8 @@
if (err)
goto out;
-@@ -348,17 +365,30 @@ static const char *wrapfs_get_link(struct dentry *dentry, struct inode *inode,
+@@ -348,17 +365,19 @@ static const char *wrapfs_get_link(struct dentry *dentry, struct inode *inode,
return buf;
}
+ struct inode *inode, int mask)
{
struct inode *lower_inode;
-+ struct dentry *dentry = NULL;
-+ struct path lower_path;
int err;
-+ /*
-+ * Grab the first dentry for this inode. All dentries should belong
-+ * to the same vfsmount so it doesn't matter which one we use.
-+ */
-+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias)
-+ break;
-+ BUG_ON(!dentry);
-+ wrapfs_get_lower_path(dentry, &lower_path);
lower_inode = wrapfs_lower_inode(inode);
- err = inode_permission(lower_inode, mask);
-+ err = inode_permission(mnt_user_ns(lower_path.mnt), lower_inode, mask);
-+ wrapfs_put_lower_path(dentry, &lower_path);
++ err = inode_permission(i_user_ns(lower_inode), lower_inode, mask);
return err;
}
{
int err;
struct dentry *lower_dentry;
-@@ -368,17 +398,17 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
+@@ -368,17 +387,17 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
struct iattr lower_ia;
inode = d_inode(dentry);
lower_dentry = lower_path.dentry;
lower_inode = wrapfs_lower_inode(inode);
-@@ -416,7 +446,8 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
+@@ -416,7 +435,8 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
* tries to open(), unlink(), then ftruncate() a file.
*/
inode_lock(d_inode(lower_dentry));
NULL);
inode_unlock(d_inode(lower_dentry));
if (err)
-@@ -432,11 +463,11 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
+@@ -432,11 +452,11 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia)
out:
wrapfs_put_lower_path(dentry, &lower_path);
u32 request_mask, unsigned int flags)
{
int err;
-@@ -450,7 +481,7 @@ static int wrapfs_getattr(const struct path *path, struct kstat *stat,
+@@ -450,7 +470,7 @@ static int wrapfs_getattr(const struct path *path, struct kstat *stat,
goto out;
fsstack_copy_attr_all(d_inode(dentry),
d_inode(lower_path.dentry));
stat->blocks = lower_stat.blocks;
out:
wrapfs_put_lower_path(dentry, &lower_path);
-@@ -470,7 +501,8 @@ wrapfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
+@@ -470,7 +490,8 @@ wrapfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
err = -EOPNOTSUPP;
goto out;
}
if (err)
goto out;
fsstack_copy_attr_all(d_inode(dentry),
-@@ -496,7 +528,8 @@ wrapfs_getxattr(struct dentry *dentry, struct inode *inode,
+@@ -496,7 +517,8 @@ wrapfs_getxattr(struct dentry *dentry, struct inode *inode,
err = -EOPNOTSUPP;
goto out;
}
if (err)
goto out;
fsstack_copy_attr_atime(d_inode(dentry),
-@@ -544,7 +577,7 @@ wrapfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name)
+@@ -544,7 +566,7 @@ wrapfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name)
err = -EOPNOTSUPP;
goto out;
}
if (err)
goto out;
fsstack_copy_attr_all(d_inode(dentry), lower_inode);
-@@ -592,6 +625,7 @@ static int wrapfs_xattr_get(const struct xattr_handler *handler,
+@@ -592,6 +614,7 @@ static int wrapfs_xattr_get(const struct xattr_handler *handler,
}
static int wrapfs_xattr_set(const struct xattr_handler *handler,