[CRIU] [PATCH 4/5] inotify: Use ghost files if the watchee is a deleted file, v2

Cyrill Gorcunov gorcunov at openvz.org
Wed Dec 5 15:46:56 EST 2012


The watch target might be a deleted file. In this case we can't
re-create it on restore procedure.

A typical scenario
------------------

 fd = inotify_init1()
 wd = open(path)
 inotify_add_watch(path)
 unlink(path)
 ... checkpoint ...

here we have a @path which is unlinked but still present in inotify
watch list because inode is not yet freed. And if the program is killed
after checkpoint the last reference to a path get eliminated and inode
get freed from the kernel memory.

Thus any furher attempts to open the path via file handle (note that file
handle can't be used to create new file, the kernel doesn't permit that)
will simply fail.

So if plain opening via file handle failed we assume that at least
the file might be in our ghost files list (we're optimists, right?)
and if we successed we simply use a path generated by ghost file
engine for us.

v2 [by xemul@]:
 - gather reference to ghost file remap early

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 inotify.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-inotify-Use-ghost-files-if-the-watchee-is-a-deleted-.patch
Type: text/x-patch
Size: 2467 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/criu/attachments/20121206/7fb1eab8/attachment-0001.bin>


More information about the CRIU mailing list