[CRIU] [PATCH] inotify: Skip opening deleted file

Cyrill Gorcunov gorcunov at openvz.org
Wed Nov 28 12:26:19 EST 2012


In case if we're monitoring deleted file we can't open
it on restore procedure, thus simply skip its recreation.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 inotify.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/inotify.c b/inotify.c
index 46b1797..207f1ea 100644
--- a/inotify.c
+++ b/inotify.c
@@ -131,6 +131,12 @@ static int restore_one_inotify(int inotify_fd, InotifyWdEntry *iwe)
 
 	target = sys_open_by_handle_at(mntfd, (void *)&handle, 0);
 	if (target < 0) {
+		if (errno == EBADF) {
+			pr_info("Skip opening deleted file handle for 0x%08x:0x%016lx",
+				  iwe->s_dev, iwe->i_ino);
+			close(mntfd);
+			return 0;
+		}
 		pr_perror("Can't open file handle for 0x%08x:0x%016lx",
 			  iwe->s_dev, iwe->i_ino);
 		return -1;
-- 
1.7.7.6



More information about the CRIU mailing list