[CRIU] [PATCH] fsnotify: Add debug printing of the target link

Cyrill Gorcunov gorcunov at openvz.org
Mon Oct 14 03:11:52 PDT 2013


Convenient for debug.

 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000000002 (via /proc/self/fd/5 -> /)
 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000083a93 (via /home/criu/test/zdtm/live/static/inotify-removed (deleted).cr.1.ghost)

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 fsnotify.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/fsnotify.c b/fsnotify.c
index 9b55578..3695c3f 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -208,13 +208,23 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
 		}
 		snprintf(buf, size, "/proc/self/fd/%d", *target);
 		path = buf;
+
+		if (log_get_loglevel() >= LOG_DEBUG) {
+			char link[PATH_MAX];
+
+			if (read_fd_link(*target, link, sizeof(link)) < 0)
+				link[0] = '\0';
+
+			pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s -> %s)\n",
+				 who, s_dev, i_ino, path, link);
+		}
 	} else {
 		*target = -1;
 		path = remap->path;
-	}
 
-	pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
-		 who, s_dev, i_ino, path);
+		pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
+			 who, s_dev, i_ino, path);
+	}
 
 err:
 	close_safe(&mntfd);
-- 
1.8.3.1



More information about the CRIU mailing list