[2/2] dump: files-ext -- Show exactly which file can't be dumped

Submitted by Cyrill Gorcunov on June 30, 2016, 7:04 p.m.

Details

Message ID 1467313485-32565-3-git-send-email-gorcunov@openvz.org
State Accepted
Series "dump: Add more information about objects we processing"
Commit f4536f8b34dc797b87e4101d7ba7701a1a2bee72
Headers show

Commit Message

Cyrill Gorcunov June 30, 2016, 7:04 p.m.
This is suitable for debugging problems.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 criu/files.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/files.c b/criu/files.c
index 719d0bebdee7..ee95fc8dfe47 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -431,6 +431,7 @@  static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 {
 	struct fd_parms p = FD_PARMS_INIT;
 	const struct fdtype_ops *ops;
+	struct fd_link link;
 
 	if (fill_fd_params(ctl, fd, lfd, opts, &p) < 0) {
 		pr_err("Can't get stat on %d\n", fd);
@@ -471,8 +472,6 @@  static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 	}
 
 	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode)) {
-		struct fd_link link;
-
 		if (fill_fdlink(lfd, &p, &link))
 			return -1;
 
@@ -495,7 +494,15 @@  static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
 		return do_dump_gen_file(&p, lfd, ops, img);
 	}
 
-	return dump_unsupp_fd(&p, lfd, img, "unknown", NULL);
+	/*
+	 * For debug purpose -- at least show the link
+	 * file pointing to when reporting unsupported file.
+	 * On error simply empty string here.
+	 */
+	if (fill_fdlink(lfd, &p, &link))
+		memzero(&link, sizeof(link));
+
+	return dump_unsupp_fd(&p, lfd, img, "unknown", link.name + 1);
 }
 
 int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,

Comments

Pavel Emelianov July 13, 2016, 12:49 p.m.
This one applied.