[CRIU] [PATCH] Get rid of " (deleted)" in symlink pathnames
Saied Kazemi
saied at google.com
Fri Jan 16 12:45:54 PST 2015
The kernel (see fs/dcache.c) appends the string " (deleted)" to a deleted
dentry pathname. We need to remove the string when reading a symlink
that contains it (e.g., symlinks in /proc/<pid>/map_files).
Signed-off-by: Saied Kazemi <saied at google.com>
---
util.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/util.c b/util.c
index e91f3fe..3fe5b6f 100644
--- a/util.c
+++ b/util.c
@@ -471,6 +471,15 @@ int read_fd_link(int lfd, char *buf, size_t size)
}
buf[ret] = 0;
+ /*
+ * For a deleted dentry, we need to strip off " (deleted)" that
+ * the kernel has appended to the pathname.
+ */
+ if (ret > 10 && !strcmp(&buf[ret - 10], " (deleted)")) {
+ ret -= 10;
+ buf[ret] = 0;
+ }
+
return ret;
}
--
2.2.0.rc0.207.ga3a616c
More information about the CRIU
mailing list