[CRIU] [PATCH] proc: Print parsed fstype for unsupported mounts

Pavel Emelyanov xemul at parallels.com
Fri Jan 23 06:50:11 PST 2015


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 proc_parse.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/proc_parse.c b/proc_parse.c
index 76fe0da..aa4755d 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -911,7 +911,7 @@ static int parse_mnt_opt(char *str, struct mount_info *mi, int *off)
 	return 0;
 }
 
-static int parse_mountinfo_ent(char *str, struct mount_info *new)
+static int parse_mountinfo_ent(char *str, struct mount_info *new, char **r_fstype)
 {
 	unsigned int kmaj, kmin;
 	int ret, n;
@@ -952,6 +952,8 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new)
 
 	ret = -1;
 	new->fstype = find_fstype_by_name(fstype);
+	if (new->fstype->code == FSTYPE__UNSUPPORTED)
+		*r_fstype = fstype; /* keep for logging */
 
 	new->options = xmalloc(strlen(opt) + 1);
 	if (!new->options)
@@ -963,7 +965,8 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new)
 	ret = 0;
 err:
 	free(opt);
-	free(fstype);
+	if (!*r_fstype)
+		free(fstype);
 	return ret;
 }
 
@@ -982,6 +985,7 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid)
 	while (fgets(str, sizeof(str), f)) {
 		struct mount_info *new;
 		int ret;
+		char *fst = NULL;
 
 		new = mnt_entry_alloc();
 		if (!new)
@@ -992,14 +996,14 @@ struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid)
 		new->next = list;
 		list = new;
 
-		ret = parse_mountinfo_ent(str, new);
+		ret = parse_mountinfo_ent(str, new, &fst);
 		if (ret < 0) {
 			pr_err("Bad format in %d mountinfo\n", pid);
 			goto err;
 		}
 
 		pr_info("\ttype %s source %s mnt_id %#x s_dev %#x %s @ %s flags %#x options %s\n",
-				new->fstype->name, new->source,
+				fst ? : new->fstype->name, new->source,
 				new->mnt_id, new->s_dev, new->root, new->mountpoint,
 				new->flags, new->options);
 
-- 
1.8.4.2



More information about the CRIU mailing list