2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

files: Support dumping/restoring of completely unlinked files

Completely unlinked file is the one with n_link count being zero.
Such files only allow to read their contents and carry with us.

In order to dump this thing I introduce the "path remap" technology.
For reg file a remapping entry is dumped which describes, that at
restore stage before opening a regfile->path this path should be
linked to some other name and then (after open) unlinked.

For completely unlinked files the remap path would be a path to
a "ghost" file, i.e. a file which is created only at the time of
restore and which is removed completely at the end of it.

Partially unlinked files (i.e. those having n_link != 0, but a
path by which we see them in someone's fd is not accessible) should
be handled in another way.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-04-13 17:54:36 +04:00
parent 14451ed3ce
commit a1ccfb9297
8 changed files with 341 additions and 10 deletions

View File

@@ -182,6 +182,18 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
.magic = FS_MAGIC,
.show = show_fs,
},
[CR_FD_REMAP_FPATH] = {
.fmt = FMT_FNAME_REMAP_FPATH,
.magic = REMAP_FPATH_MAGIC,
.show = show_remap_files,
},
[CR_FD_GHOST_FILE] = {
.fmt = FMT_FNAME_GHOST_FILE,
.magic = GHOST_FILE_MAGIC,
.show = show_ghost_file,
},
};
static struct cr_fdset *alloc_cr_fdset(int nr)