[CRIU] [PATCH 1/4] mount: Add error messages
Radostin Stoyanov
rstoyanov1 at gmail.com
Sun Nov 10 12:15:20 MSK 2019
Suggested-by: Andrei Vagin <avagin at gmail.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
criu/mount.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/criu/mount.c b/criu/mount.c
index 486d01719..d6789d93b 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1335,8 +1335,10 @@ int ns_open_mountpoint(void *arg)
}
/* Remount all mounts as private to disable propagation */
- if (mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL))
+ if (mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL)) {
+ pr_perror("Unable to remount");
goto err;
+ }
if (umount_overmounts(mi))
goto err;
@@ -1546,6 +1548,7 @@ static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_
ret = mount(source, target, type, 0, NULL);
if (ret < 0) {
+ pr_perror("Unable to mount %s %s", source, target);
exit_code = -errno;
goto restore_ns;
} else {
@@ -2014,7 +2017,10 @@ static int fetch_rt_stat(struct mount_info *m, const char *where)
static int do_simple_mount(struct mount_info *mi, const char *src, const
char *fstype, unsigned long mountflags)
{
- return mount(src, mi->mountpoint, fstype, mountflags, mi->options);
+ int ret = mount(src, mi->mountpoint, fstype, mountflags, mi->options);
+ if (ret)
+ pr_perror("mount(%s, %s)", src, mi->mountpoint);
+ return ret;
}
static char *mnt_fsname(struct mount_info *mi)
@@ -2501,8 +2507,11 @@ static int do_mount_one(struct mount_info *mi)
}
/* do_mount_root() is called from populate_mnt_ns() */
- if (mount(opts.root, mi->mountpoint, NULL, MS_BIND | MS_REC, NULL))
+ if (mount(opts.root, mi->mountpoint, NULL, MS_BIND | MS_REC, NULL)) {
+ pr_perror("mount %s %s", opts.root, mi->mountpoint);
return -1;
+ }
+
if (do_mount_root(mi))
return -1;
mi->mounted = true;
--
2.21.0
More information about the CRIU
mailing list