diff mbox series

[1/1,SRU,D] UBUNTU: SAUCE: Revert "UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs"

Message ID 20190924205551.4408-2-seth.forshee@canonical.com
State New
Headers show
Series [1/1,SRU,D] UBUNTU: SAUCE: Revert "UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs" | expand

Commit Message

Seth Forshee Sept. 24, 2019, 8:55 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1842382

This commit is causing the paths in /proc/self/maps to all show
up as / when proc is mounted over overlayfs in a chroot. Revert
the commit to fix the regression until a proper fix is found.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 fs/open.c            | 4 +---
 fs/overlayfs/file.c  | 1 -
 fs/overlayfs/super.c | 5 ++---
 fs/shiftfs.c         | 4 +---
 include/linux/fs.h   | 3 +--
 5 files changed, 5 insertions(+), 12 deletions(-)

Comments

Tyler Hicks Sept. 24, 2019, 8:59 p.m. UTC | #1
On 2019-09-24 15:55:51, Seth Forshee wrote:
> BugLink: https://bugs.launchpad.net/bugs/1842382
> 
> This commit is causing the paths in /proc/self/maps to all show
> up as / when proc is mounted over overlayfs in a chroot. Revert
> the commit to fix the regression until a proper fix is found.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>

Acked-by: Tyler Hicks <tyhicks@canonical.com>

Tyler

> ---
>  fs/open.c            | 4 +---
>  fs/overlayfs/file.c  | 1 -
>  fs/overlayfs/super.c | 5 ++---
>  fs/shiftfs.c         | 4 +---
>  include/linux/fs.h   | 3 +--
>  5 files changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/open.c b/fs/open.c
> index c263d9f1372c..2fefa22cec99 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -933,15 +933,13 @@ struct file *dentry_open(const struct path *path, int flags,
>  EXPORT_SYMBOL(dentry_open);
>  
>  struct file *open_with_fake_path(const struct path *path, int flags,
> -				 struct inode *inode, struct dentry *dentry,
> -				 const struct cred *cred)
> +				struct inode *inode, const struct cred *cred)
>  {
>  	struct file *f = alloc_empty_file_noaccount(flags, cred);
>  	if (!IS_ERR(f)) {
>  		int error;
>  
>  		f->f_path = *path;
> -		f->f_path.dentry = dentry;
>  		error = do_dentry_open(f, inode, NULL);
>  		if (error) {
>  			fput(f);
> diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
> index fcc345207dc6..75d8d00fa087 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -34,7 +34,6 @@ static struct file *ovl_open_realfile(const struct file *file,
>  
>  	old_cred = ovl_override_creds(inode->i_sb);
>  	realfile = open_with_fake_path(&file->f_path, flags, realinode,
> -				       ovl_dentry_real(file->f_path.dentry),
>  				       current_cred());
>  	revert_creds(old_cred);
>  
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index b4fb0c402216..3bd48da819c2 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -753,14 +753,13 @@ static int ovl_mount_dir(const char *name, struct path *path)
>  		ovl_unescape(tmp);
>  		err = ovl_mount_dir_noesc(tmp, path);
>  
> -		if (!err) {
> -			if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && ovl_dentry_remote(path->dentry)) {
> +		if (!err)
> +			if (ovl_dentry_remote(path->dentry)) {
>  				pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n",
>  				       tmp);
>  				path_put_init(path);
>  				err = -EINVAL;
>  			}
> -		}
>  		kfree(tmp);
>  	}
>  	return err;
> diff --git a/fs/shiftfs.c b/fs/shiftfs.c
> index 450e93b8b5b8..9006201c243d 100644
> --- a/fs/shiftfs.c
> +++ b/fs/shiftfs.c
> @@ -1048,9 +1048,7 @@ static struct file *shiftfs_open_realfile(const struct file *file,
>  	oldcred = shiftfs_override_creds(inode->i_sb);
>  	/* XXX: open_with_fake_path() not gauranteed to stay around, if
>  	 * removed use dentry_open() */
> -	lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
> -				     realpath->dentry,
> -				     info->creator_cred);
> +	lowerf = open_with_fake_path(realpath, file->f_flags, loweri, info->creator_cred);
>  	revert_creds(oldcred);
>  
>  	return lowerf;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 29ab8aa9551a..c4f9a8cde113 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2527,8 +2527,7 @@ extern struct file *file_open_root(struct dentry *, struct vfsmount *,
>  				   const char *, int, umode_t);
>  extern struct file * dentry_open(const struct path *, int, const struct cred *);
>  extern struct file * open_with_fake_path(const struct path *, int,
> -					 struct inode*, struct dentry *dentry,
> -					 const struct cred *);
> +					 struct inode*, const struct cred *);
>  static inline struct file *file_clone_open(struct file *file)
>  {
>  	return dentry_open(&file->f_path, file->f_flags, file->f_cred);
> -- 
> 2.20.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/fs/open.c b/fs/open.c
index c263d9f1372c..2fefa22cec99 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -933,15 +933,13 @@  struct file *dentry_open(const struct path *path, int flags,
 EXPORT_SYMBOL(dentry_open);
 
 struct file *open_with_fake_path(const struct path *path, int flags,
-				 struct inode *inode, struct dentry *dentry,
-				 const struct cred *cred)
+				struct inode *inode, const struct cred *cred)
 {
 	struct file *f = alloc_empty_file_noaccount(flags, cred);
 	if (!IS_ERR(f)) {
 		int error;
 
 		f->f_path = *path;
-		f->f_path.dentry = dentry;
 		error = do_dentry_open(f, inode, NULL);
 		if (error) {
 			fput(f);
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index fcc345207dc6..75d8d00fa087 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -34,7 +34,6 @@  static struct file *ovl_open_realfile(const struct file *file,
 
 	old_cred = ovl_override_creds(inode->i_sb);
 	realfile = open_with_fake_path(&file->f_path, flags, realinode,
-				       ovl_dentry_real(file->f_path.dentry),
 				       current_cred());
 	revert_creds(old_cred);
 
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index b4fb0c402216..3bd48da819c2 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -753,14 +753,13 @@  static int ovl_mount_dir(const char *name, struct path *path)
 		ovl_unescape(tmp);
 		err = ovl_mount_dir_noesc(tmp, path);
 
-		if (!err) {
-			if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && ovl_dentry_remote(path->dentry)) {
+		if (!err)
+			if (ovl_dentry_remote(path->dentry)) {
 				pr_err("overlayfs: filesystem on '%s' not supported as upperdir\n",
 				       tmp);
 				path_put_init(path);
 				err = -EINVAL;
 			}
-		}
 		kfree(tmp);
 	}
 	return err;
diff --git a/fs/shiftfs.c b/fs/shiftfs.c
index 450e93b8b5b8..9006201c243d 100644
--- a/fs/shiftfs.c
+++ b/fs/shiftfs.c
@@ -1048,9 +1048,7 @@  static struct file *shiftfs_open_realfile(const struct file *file,
 	oldcred = shiftfs_override_creds(inode->i_sb);
 	/* XXX: open_with_fake_path() not gauranteed to stay around, if
 	 * removed use dentry_open() */
-	lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
-				     realpath->dentry,
-				     info->creator_cred);
+	lowerf = open_with_fake_path(realpath, file->f_flags, loweri, info->creator_cred);
 	revert_creds(oldcred);
 
 	return lowerf;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 29ab8aa9551a..c4f9a8cde113 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2527,8 +2527,7 @@  extern struct file *file_open_root(struct dentry *, struct vfsmount *,
 				   const char *, int, umode_t);
 extern struct file * dentry_open(const struct path *, int, const struct cred *);
 extern struct file * open_with_fake_path(const struct path *, int,
-					 struct inode*, struct dentry *dentry,
-					 const struct cred *);
+					 struct inode*, const struct cred *);
 static inline struct file *file_clone_open(struct file *file)
 {
 	return dentry_open(&file->f_path, file->f_flags, file->f_cred);