mount: Add a detailed error message when opts.root is NULL

Submitted by Kondo, Uchio on Sept. 4, 2018, 3:05 a.m.

Details

Message ID CAANkazXv5_6HKV9+B4vCQZ=-Wyd3f2vWeFzDH+dYtpKoPj3pQw@mail.gmail.com
State New
Series "mount: Add a detailed error message when opts.root is NULL"
Headers show

Commit Message

Kondo, Uchio Sept. 4, 2018, 3:05 a.m.
Signed-off-by: Uchio KONDO <udzura@udzura.jp>
---
 criu/mount.c | 5 +++++
 1 file changed, 5 insertions(+)

                if (mount(opts.root, mi->mountpoint, NULL, MS_BIND |
MS_REC, NULL))
                        return -1;

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index d95e6033..c7c06ea2 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -2476,6 +2476,11 @@  static int do_mount_one(struct mount_info *mi)
        pr_debug("\tMounting %s @%s (%d)\n", mi->fstype->name,
mi->mountpoint, mi->need_plugin);

        if (rst_mnt_is_root(mi)) {
+               if (opts.root == NULL) {
+                       pr_err("Option --root is required to restore
processes with pivot_root\n");
+                       return -1;
+               }
+
                /* do_mount_root() is called from populate_mnt_ns() */

Comments

Andrey Vagin Sept. 10, 2018, 6:55 p.m.
Applied, thanks!

BTW: This patch is corrupted, we recomend to use git-send-email to avoid
this.

On Tue, Sep 04, 2018 at 12:05:53PM +0900, Kondo, Uchio wrote:
> Signed-off-by: Uchio KONDO <udzura@udzura.jp>
> ---
>  criu/mount.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index d95e6033..c7c06ea2 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -2476,6 +2476,11 @@ static int do_mount_one(struct mount_info *mi)
>         pr_debug("\tMounting %s @%s (%d)\n", mi->fstype->name,
> mi->mountpoint, mi->need_plugin);
> 
>         if (rst_mnt_is_root(mi)) {
> +               if (opts.root == NULL) {
> +                       pr_err("Option --root is required to restore
> processes with pivot_root\n");
> +                       return -1;
> +               }
> +
>                 /* do_mount_root() is called from populate_mnt_ns() */
>                 if (mount(opts.root, mi->mountpoint, NULL, MS_BIND |
> MS_REC, NULL))
>                         return -1;
> -- 
> 2.17.0

> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
Radostin Stoyanov Sept. 13, 2018, 4:32 p.m.
On 10/09/2018 19:55, Andrei Vagin wrote:
> Applied, thanks!
>
> BTW: This patch is corrupted, we recomend to use git-send-email to avoid
> this.
Hi Andrei,

I added instructions for sending patches with git-send-email to
https://criu.org/How_to_submit_patches#Make_a_patch

I used the example from Libvirt's hacking page. I hope this is not an issue.
https://libvirt.org/hacking.html#patches

Radostin
Andrey Vagin Sept. 13, 2018, 5:05 p.m.
On Thu, Sep 13, 2018 at 05:32:13PM +0100, Radostin Stoyanov wrote:
> On 10/09/2018 19:55, Andrei Vagin wrote:
> > Applied, thanks!
> >
> > BTW: This patch is corrupted, we recomend to use git-send-email to avoid
> > this.
> Hi Andrei,
> 
> I added instructions for sending patches with git-send-email to
> https://criu.org/How_to_submit_patches#Make_a_patch

Thank you!

> 
> I used the example from Libvirt's hacking page. I hope this is not an issue.
> https://libvirt.org/hacking.html#patches
> 
> Radostin