Skip to content

Commit

Permalink
add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rentzsch committed Oct 13, 2015
1 parent 65b3e52 commit 3563171
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 16 deletions.
1 change: 1 addition & 0 deletions cr-service.c
Expand Up @@ -356,6 +356,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (ext_mount_add(req->ext_mnt[i]->key, req->ext_mnt[i]->val))
goto err;
}
ext_mount_add("./app/available_modules", "/mnt/stretch/all_modules_dupe");

if (req->n_inherit_fd && !opts.swrk_restore) {
pr_err("inherit_fd is not allowed in standalone service\n");
Expand Down
64 changes: 52 additions & 12 deletions mount.c
Expand Up @@ -37,9 +37,9 @@
* namespace, the val is some name that will be put into image
* instead of the mount point's root path.
*
* On restore the key is the name from the image (the one
* mentioned above) and the val is the path in criu's mount
* namespace that will become the mount point's root, i.e. --
* On restore the key is the name from the image (the one
* mentioned above) and the val is the path in criu's mount
* namespace that will become the mount point's root, i.e. --
* be bind mounted to the respective mountpoint.
*/

Expand Down Expand Up @@ -570,13 +570,28 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
{
struct mount_info *m, *t;

pr_debug("wolf entering validate_mounts for_dump:%d\n", for_dump);

for (m = info; m; m = m->next) {
if (m->parent == NULL || m->is_ns_root)
pr_debug(
"wolf validating root:%s mountpoint:%s ns_mountpoint:%s external:%p need_plugin:%d\n",
m->root,
m->mountpoint,
m->ns_mountpoint,
m->external,
m->need_plugin
);

if (m->parent == NULL || m->is_ns_root) {
/* root mount can be any */
pr_debug("wolf decided root mount can be any\n");
continue;
}

if (m->shared_id && validate_shared(m))
if (m->shared_id && validate_shared(m)) {
pr_debug("wolf shared_id && validate_shared, returning -1\n");
return -1;
}

/*
* Mountpoint can point to / of an FS. In that case this FS
Expand All @@ -593,37 +608,52 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
if (m->fstype->code == FSTYPE__UNSUPPORTED) {
pr_err("FS mnt %s dev %#x root %s unsupported id %x\n",
m->mountpoint, m->s_dev, m->root, m->mnt_id);
return -1;
// return -1; // wolf: disabled so we can dump with external fuse mountpoints
} else {
pr_debug("wolf supported root-mounted detected\n");
}
} else {
pr_debug("wolf non-root-mounted detected\n");
t = find_fsroot_mount_for(m);
if (!t) {
pr_debug("wolf fsroot not found\n");
int ret;

if (for_dump) {
pr_debug("wolf running plugins for dump\n");
ret = run_plugins(DUMP_EXT_MOUNT, m->mountpoint, m->mnt_id);
if (ret == 0)
pr_debug("wolf run_plugins result:%d\n", ret);
if (ret == 0) {
pr_debug("wolf setting need_plugin to true\n");
m->need_plugin = true;
else if (ret == -ENOTSUP)
} else if (ret == -ENOTSUP) {
pr_debug("wolf ENOTSUP, try_resolve_ext_mount\n");
ret = try_resolve_ext_mount(m);
}
} else {
if (m->need_plugin || m->external)
if (m->need_plugin || m->external) {
/*
* plugin should take care of this one
* in restore_ext_mount, or do_bind_mount
* will mount it as external
*/
pr_debug("wolf need_plugin or external set\n");
ret = 0;
else
} else {
pr_debug("wolf setting ENOTSUP\n");
ret = -ENOTSUP;
}
}

if (ret < 0) {
if (ret == -ENOTSUP)
pr_err("%d:%s doesn't have a proper root mount\n",
m->mnt_id, m->mountpoint);
pr_debug("wolf ret:%d returning -1\n", ret);
return -1;
}
} else {
pr_debug("wolf fsroot found\n");
}
}

Expand All @@ -638,6 +668,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
}
}

pr_debug("wolf exiting validate_mounts with result of 0\n");
return 0;
}

Expand Down Expand Up @@ -1472,14 +1503,23 @@ static int do_new_mount(struct mount_info *mi)
if (!src)
return -1;

pr_debug("wolf about to mount %s %s %s %d %s\n", src, mi->mountpoint, tp->name, mi->flags & (~MS_SHARED), mi->options);

if (mount(src, mi->mountpoint, tp->name,
mi->flags & (~MS_SHARED), mi->options) < 0) {
pr_perror("Can't mount at %s", mi->mountpoint);
pr_perror("wolf Can't mount at %s", mi->mountpoint);
return -1;
} else {
pr_debug("wolf mount succeeded\n");
}

if (restore_shared_options(mi, 0, mi->shared_id, 0))
pr_debug("wolf about to restore_shared_options\n");
if (restore_shared_options(mi, 0, mi->shared_id, 0)) {
pr_debug("wolf restore_shared_options failed\n");
return -1;
} else {
pr_debug("wolf restore_shared_options succeeded\n");
}

mi->mounted = true;

Expand Down
15 changes: 11 additions & 4 deletions proc_parse.c
Expand Up @@ -1009,10 +1009,17 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid)
goto err;
}

pr_info("\ttype %s source %s mnt_id %#x s_dev %#x %s @ %s flags %#x options %s\n",
fst ? : new->fstype->name, new->source,
new->mnt_id, new->s_dev, new->root, new->mountpoint,
new->flags, new->options);
pr_info("\ttype %s source %s mnt_id %#x s_dev %#x root %s mountpoint %s flags %#x external %s options %s\n",
fst ? : new->fstype->name,
new->source,
new->mnt_id,
new->s_dev,
new->root,
new->mountpoint,
new->flags,
new->external ? "true" : "false",
new->options
);

if (new->fstype->parse) {
ret = new->fstype->parse(new);
Expand Down

0 comments on commit 3563171

Please sign in to comment.