2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 08:45: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

@@ -44,6 +44,7 @@ enum {
CR_FD_PSTREE,
CR_FD_SHMEM_PAGES,
CR_FD_GHOST_FILE,
_CR_FD_GLOB_FROM,
CR_FD_SK_QUEUES,
@@ -52,6 +53,7 @@ enum {
CR_FD_UNIXSK,
CR_FD_PIPES,
CR_FD_PIPES_DATA,
CR_FD_REMAP_FPATH,
_CR_FD_GLOB_TO,
CR_FD_MAX
@@ -94,6 +96,8 @@ void show_sigacts(int fd_sigacts, struct cr_options *o);
void show_itimers(int fd, struct cr_options *o);
void show_creds(int fd, struct cr_options *o);
void show_fs(int fd, struct cr_options *o);
void show_remap_files(int fd, struct cr_options *o);
void show_ghost_file(int fd, struct cr_options *o);
void show_fown_cont(fown_t *fown);
extern void print_data(unsigned long addr, unsigned char *data, size_t size);
@@ -121,6 +125,8 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
#define FMT_FNAME_IPCNS_SEM "ipcns-sem-%d.img"
#define FMT_FNAME_SK_QUEUES "sk-queues.img"
#define FMT_FNAME_FS "fs-%d.img"
#define FMT_FNAME_REMAP_FPATH "remap-fpath.img"
#define FMT_FNAME_GHOST_FILE "ghost-file-%x.img"
extern int open_image_dir(void);
extern void close_image_dir(void);