[PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Christian Brauner
From: Christian Brauner <[hidden email]>

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

This patch enables overlayfs to use shiftfs as an underlay.

Currently it is not possible to use overlayfs on top of shiftfs. This
means Docker inside of LXD cannot make user of the overlay2 graph driver
which is blocking users such as Travis from making use of it
efficiently.

Co-Developed-by: Seth Forshee <[hidden email]>
Signed-off-by: Seth Forshee <[hidden email]>
Signed-off-by: Christian Brauner <[hidden email]>
---
 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, 12 insertions(+), 5 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 14502dde6403..b8268a334dc9 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -914,13 +914,15 @@ 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, const struct cred *cred)
+ struct inode *inode, struct dentry *dentry,
+ 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 6f6eb638a320..fe61b86c843b 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name, struct path *path)
  ovl_unescape(tmp);
  err = ovl_mount_dir_noesc(tmp, path);
 
- if (!err)
- if (ovl_dentry_remote(path->dentry)) {
+ if (!err) {
+ if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && 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 49f6714e9f95..400c3062365c 100644
--- a/fs/shiftfs.c
+++ b/fs/shiftfs.c
@@ -1048,7 +1048,9 @@ 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, info->creator_cred);
+ lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
+     realpath->dentry,
+     info->creator_cred);
  revert_creds(oldcred);
 
  return lowerf;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5dd548c73f8d..4cb7a1124c5f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2524,7 +2524,8 @@ 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*, const struct cred *);
+ struct inode*, struct dentry *dentry,
+ 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.22.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[E/Unstable]: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Seth Forshee
On Thu, Aug 01, 2019 at 08:08:29PM +0200, Christian Brauner wrote:

> From: Christian Brauner <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1838677
>
> This patch enables overlayfs to use shiftfs as an underlay.
>
> Currently it is not possible to use overlayfs on top of shiftfs. This
> means Docker inside of LXD cannot make user of the overlay2 graph driver
> which is blocking users such as Travis from making use of it
> efficiently.
>
> Co-Developed-by: Seth Forshee <[hidden email]>
> Signed-off-by: Seth Forshee <[hidden email]>
> Signed-off-by: Christian Brauner <[hidden email]>

I don't think it's appropriate for me to ack this since I helped develop
the patch. But please remember to include the development release on
patch submissions when appropriate.

Applied to unstable/master and eoan/master-next, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Stefan Bader-2
In reply to this post by Christian Brauner
On 01.08.19 20:08, Christian Brauner wrote:

> From: Christian Brauner <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1838677
>
> This patch enables overlayfs to use shiftfs as an underlay.
>
> Currently it is not possible to use overlayfs on top of shiftfs. This
> means Docker inside of LXD cannot make user of the overlay2 graph driver
> which is blocking users such as Travis from making use of it
> efficiently.
>
> Co-Developed-by: Seth Forshee <[hidden email]>
> Signed-off-by: Seth Forshee <[hidden email]>
> Signed-off-by: Christian Brauner <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---
>  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, 12 insertions(+), 5 deletions(-)
>
> diff --git a/fs/open.c b/fs/open.c
> index 14502dde6403..b8268a334dc9 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -914,13 +914,15 @@ 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, const struct cred *cred)
> + struct inode *inode, struct dentry *dentry,
> + 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 6f6eb638a320..fe61b86c843b 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name, struct path *path)
>   ovl_unescape(tmp);
>   err = ovl_mount_dir_noesc(tmp, path);
>  
> - if (!err)
> - if (ovl_dentry_remote(path->dentry)) {
> + if (!err) {
> + if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && 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 49f6714e9f95..400c3062365c 100644
> --- a/fs/shiftfs.c
> +++ b/fs/shiftfs.c
> @@ -1048,7 +1048,9 @@ 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, info->creator_cred);
> + lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
> +     realpath->dentry,
> +     info->creator_cred);
>   revert_creds(oldcred);
>  
>   return lowerf;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 5dd548c73f8d..4cb7a1124c5f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2524,7 +2524,8 @@ 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*, const struct cred *);
> + struct inode*, struct dentry *dentry,
> + 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);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK/cmnt: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Kleber Souza
In reply to this post by Christian Brauner
On 8/1/19 8:08 PM, Christian Brauner wrote:

> From: Christian Brauner <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1838677
>
> This patch enables overlayfs to use shiftfs as an underlay.
>
> Currently it is not possible to use overlayfs on top of shiftfs. This
> means Docker inside of LXD cannot make user of the overlay2 graph driver
> which is blocking users such as Travis from making use of it
> efficiently.
>
> Co-Developed-by: Seth Forshee <[hidden email]>
> Signed-off-by: Seth Forshee <[hidden email]>
> Signed-off-by: Christian Brauner <[hidden email]>

Hi Christian,

The LP bug states:

> Target kernels: All LTS kernels that do support shiftfs, if possible.

Will this patch be submitted for Bionic and Xenial as well?


Acked-by: Kleber Sacilotto de Souza <[hidden email]>

Thanks,
Kleber

> ---
>  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, 12 insertions(+), 5 deletions(-)
>
> diff --git a/fs/open.c b/fs/open.c
> index 14502dde6403..b8268a334dc9 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -914,13 +914,15 @@ 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, const struct cred *cred)
> + struct inode *inode, struct dentry *dentry,
> + 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 6f6eb638a320..fe61b86c843b 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name, struct path *path)
>   ovl_unescape(tmp);
>   err = ovl_mount_dir_noesc(tmp, path);
>  
> - if (!err)
> - if (ovl_dentry_remote(path->dentry)) {
> + if (!err) {
> + if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && 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 49f6714e9f95..400c3062365c 100644
> --- a/fs/shiftfs.c
> +++ b/fs/shiftfs.c
> @@ -1048,7 +1048,9 @@ 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, info->creator_cred);
> + lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
> +     realpath->dentry,
> +     info->creator_cred);
>   revert_creds(oldcred);
>  
>   return lowerf;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 5dd548c73f8d..4cb7a1124c5f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2524,7 +2524,8 @@ 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*, const struct cred *);
> + struct inode*, struct dentry *dentry,
> + 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);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Khalid Elmously
In reply to this post by Christian Brauner
On 2019-08-01 20:08:29 , Christian Brauner wrote:

> From: Christian Brauner <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1838677
>
> This patch enables overlayfs to use shiftfs as an underlay.
>
> Currently it is not possible to use overlayfs on top of shiftfs. This
> means Docker inside of LXD cannot make user of the overlay2 graph driver
> which is blocking users such as Travis from making use of it
> efficiently.
>
> Co-Developed-by: Seth Forshee <[hidden email]>
> Signed-off-by: Seth Forshee <[hidden email]>
> Signed-off-by: Christian Brauner <[hidden email]>
> ---
>  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, 12 insertions(+), 5 deletions(-)
>
> diff --git a/fs/open.c b/fs/open.c
> index 14502dde6403..b8268a334dc9 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -914,13 +914,15 @@ 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, const struct cred *cred)
> + struct inode *inode, struct dentry *dentry,
> + 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 6f6eb638a320..fe61b86c843b 100644
> --- a/fs/overlayfs/file.c
> +++ b/fs/overlayfs/file.c
> @@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name, struct path *path)
>   ovl_unescape(tmp);
>   err = ovl_mount_dir_noesc(tmp, path);
>  
> - if (!err)
> - if (ovl_dentry_remote(path->dentry)) {
> + if (!err) {
> + if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) && 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 49f6714e9f95..400c3062365c 100644
> --- a/fs/shiftfs.c
> +++ b/fs/shiftfs.c
> @@ -1048,7 +1048,9 @@ 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, info->creator_cred);
> + lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
> +     realpath->dentry,
> +     info->creator_cred);
>   revert_creds(oldcred);
>  
>   return lowerf;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 5dd548c73f8d..4cb7a1124c5f 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2524,7 +2524,8 @@ 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*, const struct cred *);
> + struct inode*, struct dentry *dentry,
> + 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.22.0
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: ACK/cmnt: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Christian Brauner
In reply to this post by Kleber Souza
On August 12, 2019 4:02:33 PM GMT+02:00, Kleber Souza <[hidden email]> wrote:

>On 8/1/19 8:08 PM, Christian Brauner wrote:
>> From: Christian Brauner <[hidden email]>
>>
>> BugLink: https://bugs.launchpad.net/bugs/1838677
>>
>> This patch enables overlayfs to use shiftfs as an underlay.
>>
>> Currently it is not possible to use overlayfs on top of shiftfs. This
>> means Docker inside of LXD cannot make user of the overlay2 graph
>driver
>> which is blocking users such as Travis from making use of it
>> efficiently.
>>
>> Co-Developed-by: Seth Forshee <[hidden email]>
>> Signed-off-by: Seth Forshee <[hidden email]>
>> Signed-off-by: Christian Brauner <[hidden email]>
>
>Hi Christian,
>
>The LP bug states:
>
>> Target kernels: All LTS kernels that do support shiftfs, if possible.
>
>Will this patch be submitted for Bionic and Xenial as well?

Sorry, was on vacation.
It should go into all kernels that have shiftfs support. :)
Seth probably knows better whether we have this in Bionic and Xenial. I reckon we do.
Seth, do I need to submit this separate patches?

Christian

>
>
>Acked-by: Kleber Sacilotto de Souza <[hidden email]>
>
>Thanks,
>Kleber
>
>> ---
>>  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, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/open.c b/fs/open.c
>> index 14502dde6403..b8268a334dc9 100644
>> --- a/fs/open.c
>> +++ b/fs/open.c
>> @@ -914,13 +914,15 @@ 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, const struct cred *cred)
>> + struct inode *inode, struct dentry *dentry,
>> + 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 6f6eb638a320..fe61b86c843b 100644
>> --- a/fs/overlayfs/file.c
>> +++ b/fs/overlayfs/file.c
>> @@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
>> --- a/fs/overlayfs/super.c
>> +++ b/fs/overlayfs/super.c
>> @@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name,
>struct path *path)
>>   ovl_unescape(tmp);
>>   err = ovl_mount_dir_noesc(tmp, path);
>>  
>> - if (!err)
>> - if (ovl_dentry_remote(path->dentry)) {
>> + if (!err) {
>> + if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) &&
>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 49f6714e9f95..400c3062365c 100644
>> --- a/fs/shiftfs.c
>> +++ b/fs/shiftfs.c
>> @@ -1048,7 +1048,9 @@ 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,
>info->creator_cred);
>> + lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
>> +     realpath->dentry,
>> +     info->creator_cred);
>>   revert_creds(oldcred);
>>  
>>   return lowerf;
>> diff --git a/include/linux/fs.h b/include/linux/fs.h
>> index 5dd548c73f8d..4cb7a1124c5f 100644
>> --- a/include/linux/fs.h
>> +++ b/include/linux/fs.h
>> @@ -2524,7 +2524,8 @@ 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*, const struct cred *);
>> + struct inode*, struct dentry *dentry,
>> + 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);
>>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: ACK/cmnt: [PATCH][SRU][Disco] UBUNTU: SAUCE: shiftfs: enable overlayfs on shiftfs

Kleber Souza
On 8/13/19 7:57 AM, Christian Brauner wrote:

> On August 12, 2019 4:02:33 PM GMT+02:00, Kleber Souza <[hidden email]> wrote:
>> On 8/1/19 8:08 PM, Christian Brauner wrote:
>>> From: Christian Brauner <[hidden email]>
>>>
>>> BugLink: https://bugs.launchpad.net/bugs/1838677
>>>
>>> This patch enables overlayfs to use shiftfs as an underlay.
>>>
>>> Currently it is not possible to use overlayfs on top of shiftfs. This
>>> means Docker inside of LXD cannot make user of the overlay2 graph
>> driver
>>> which is blocking users such as Travis from making use of it
>>> efficiently.
>>>
>>> Co-Developed-by: Seth Forshee <[hidden email]>
>>> Signed-off-by: Seth Forshee <[hidden email]>
>>> Signed-off-by: Christian Brauner <[hidden email]>
>>
>> Hi Christian,
>>
>> The LP bug states:
>>
>>> Target kernels: All LTS kernels that do support shiftfs, if possible.
>>
>> Will this patch be submitted for Bionic and Xenial as well?
>
> Sorry, was on vacation.
> It should go into all kernels that have shiftfs support. :)
> Seth probably knows better whether we have this in Bionic and Xenial. I reckon we do.
> Seth, do I need to submit this separate patches?

The file 'fs/shiftfs.c' doesn't exist in B/X, so I assume
it's not needed beyond Disco.


Thanks,
Kleber

>
> Christian
>
>>
>>
>> Acked-by: Kleber Sacilotto de Souza <[hidden email]>
>>
>> Thanks,
>> Kleber
>>
>>> ---
>>>  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, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/fs/open.c b/fs/open.c
>>> index 14502dde6403..b8268a334dc9 100644
>>> --- a/fs/open.c
>>> +++ b/fs/open.c
>>> @@ -914,13 +914,15 @@ 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, const struct cred *cred)
>>> + struct inode *inode, struct dentry *dentry,
>>> + 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 6f6eb638a320..fe61b86c843b 100644
>>> --- a/fs/overlayfs/file.c
>>> +++ b/fs/overlayfs/file.c
>>> @@ -33,6 +33,7 @@ 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 bb2a6f80ffd0..46def89a3664 100644
>>> --- a/fs/overlayfs/super.c
>>> +++ b/fs/overlayfs/super.c
>>> @@ -748,13 +748,14 @@ static int ovl_mount_dir(const char *name,
>> struct path *path)
>>>   ovl_unescape(tmp);
>>>   err = ovl_mount_dir_noesc(tmp, path);
>>>  
>>> - if (!err)
>>> - if (ovl_dentry_remote(path->dentry)) {
>>> + if (!err) {
>>> + if ((path->dentry->d_sb->s_magic != SHIFTFS_MAGIC) &&
>> 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 49f6714e9f95..400c3062365c 100644
>>> --- a/fs/shiftfs.c
>>> +++ b/fs/shiftfs.c
>>> @@ -1048,7 +1048,9 @@ 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,
>> info->creator_cred);
>>> + lowerf = open_with_fake_path(realpath, file->f_flags, loweri,
>>> +     realpath->dentry,
>>> +     info->creator_cred);
>>>   revert_creds(oldcred);
>>>  
>>>   return lowerf;
>>> diff --git a/include/linux/fs.h b/include/linux/fs.h
>>> index 5dd548c73f8d..4cb7a1124c5f 100644
>>> --- a/include/linux/fs.h
>>> +++ b/include/linux/fs.h
>>> @@ -2524,7 +2524,8 @@ 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*, const struct cred *);
>>> + struct inode*, struct dentry *dentry,
>>> + 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);
>>>
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team