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

2424 Commits

Author SHA1 Message Date
Cyrill Gorcunov
d5bdf54eab fsnotify: fanotify -- Fix object read procedure
I occasionally read FanotifyMarkEntry object as InotifyWdEntry
in collect_one_fanotify_mark, this didn't trigger a bug in test
since the events are still occured (and before protobuf file
refine the formats were close to each other), which means
the fanotify00 test-case need to be updated (which is addressed
in further patch).

And don't forget to init fields.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:19:43 +04:00
Cyrill Gorcunov
29c940072a fsnotify: inotify -- Don't forget to init fields of fsnotify_mark_info
The object is allocated with malloc. The lack of initialization
is not problem at moment since we assign members in
collect_inotify_mark unconditionally but it might cause problems
in future so better to init it as early as possible.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:19:42 +04:00
Cyrill Gorcunov
c28573fda1 zdtm: fanotify00 -- Make test to check all flags we c/r
Just reading if event entry exist in buffer is not
enough we rathee need to be sure that all flags
and bits are recovered well.

For this sake we parse fdinfo before and after the
c/r sessions and compare results.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:19:05 +04:00
Cyrill Gorcunov
12b579bac0 fsnotify: fanotify -- Take into accout global flag assigned to fanotify object
Just missed it in first place.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:18:45 +04:00
Cyrill Gorcunov
27c8a3cf65 fsnotify: Rename collect_one_wd to collect_one_inotify_mark
To be consistent with naming (we have collect_one_fanotify_mark
helper already).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:18:03 +04:00
Cyrill Gorcunov
d6664eea4a proc-parse: Add alloc_fhandle/free_fhandle helpers
This removes code duplication. There is no strong
need for free_fhandle but I decided to add it to
be consistent with alloc/free handlers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:17:46 +04:00
Cyrill Gorcunov
8573f5ec53 fsnotify: Drop parasite trailing \Space
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 18:17:23 +04:00
Pavel Emelyanov
3a1c7d1d76 ns: Introduce ns descriptors
These are structs that (now) tie together ns string
and the CLONE_ flag. It's nice to have one (some code
becomes simpler) and will help us with auto-namespaces
detection.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:24:01 +04:00
Cyrill Gorcunov
eb8f8c12cd fsnotify: fanotify -- Group objects in image
As Pavel proposed we can refine fanotify image objects
squeezing common part in separate entry. Finally the objects
are grouped as

enum mark_type {
	INODE	= 1;
	MOUNT	= 2;
}

message fanotify_inode_mark_entry {
	required uint64		i_ino		= 1;
	required fh_entry	f_handle	= 2;
}

message fanotify_mount_mark_entry {
	required uint32		mnt_id		= 1;
}

message fanotify_mark_entry {
	required uint32		id		= 1;
	required mark_type	type		= 2;

	required uint32		mflags		= 3;
	required uint32		mask		= 4;
	required uint32		ignored_mask	= 5;
	required uint32		s_dev		= 6;

	optional fanotify_inode_mark_entry ie	= 7;
	optional fanotify_mount_mark_entry me	= 8;
}

This required some tuning in fdinfo parsing and
fsnotify code itself, but result looks good to me.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:17:57 +04:00
Pavel Emelyanov
fd72e27d90 inventory: Show this image with standard pb showers
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 23:16:34 +04:00
Cyrill Gorcunov
5730f8173c zdtm: fanotify00 -- Use exit instead of fail until test_daemon call
As Andrew pointed the logically it's more correct to use
err() instead of fail() if test_daemon() has not been
used.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 19:07:04 +04:00
Andrey Vagin
3f3498bccd net: a file descriptor can be zero
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:53:00 +04:00
Andrey Vagin
f2a46c3d00 util: check that stdin are unused before closing
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:52:59 +04:00
Andrey Vagin
e7189054d5 restore: close_old_fds after restoring namespaces
Restore of netns uses the file descriptor on the root netns. This
descriptor is opened before forking.
We can add one more service fd, but I think this approach is better.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:52:57 +04:00
Cyrill Gorcunov
bce18732d7 zdtm: Add fanotify00 test
This one is pretty trivial and need to be extented for
more masks and flags, but fine for now.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:52 +04:00
Cyrill Gorcunov
962af52932 fsnotify: Add dumping of fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:50 +04:00
Cyrill Gorcunov
d5927a47f1 proc-parse: Add parsing of fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:49 +04:00
Cyrill Gorcunov
05bb44960f dump: Collect mount information on dump
For fanotify dumping we need to find mount points the path
lay on, moreover we save a mount point device number in the
image, thus collect mount point information on dump stage.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:48 +04:00
Cyrill Gorcunov
ddf773585b fsnotify: Add restore for fanotify
The same way as done for inotify we walk over
all marks hooked on file entry and restore them
with sys_fanotify_mark call.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:46 +04:00
Cyrill Gorcunov
f1f0be2d20 fsnotify: fanotify -- Add collecting of fanotify objects
No real restore yet, but only collecting of file entries
and marks for simplicity.

Ideally, once everything will be ready and tested we will
unitfy generic fsnotify restore engine. But for a while
for debug reason inotify and fanotify kept separated.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:45 +04:00
Cyrill Gorcunov
eb1fc62de9 fsnotify: Rename info_head to inotify_info_head
fanotify and inotify will be gathered to separate lists.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:44 +04:00
Cyrill Gorcunov
a124f7c67d fsnotify: Rename collect_mark to collect_inotify_mark
We will need collect_fanotify_mark helper so unify naming scheme.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:43 +04:00
Cyrill Gorcunov
a5f5b17d56 fsnotify: Rename collect_one_ify to collect_one_inotify
fanotify will have collect_one_fanotify helper, so to unify
naming scheme rename this one.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:42 +04:00
Cyrill Gorcunov
874f513201 fsnotify: Rename desc_ops to inotify_desc_ops
fanotify will have own descriptor so to avoid
confusion rename it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:41 +04:00
Cyrill Gorcunov
e73f99300d fsnotify: Extend fsnotify_file_info to carry fanotify file entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:40 +04:00
Cyrill Gorcunov
67ccef7e1b fsnotify: Rename inotify_file_info to fsnotify_file_info
It will carry fanotify file entries as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:39 +04:00
Cyrill Gorcunov
abdadb51b3 fsnotify: Extend fsnotify_mark_info to carry fanotify marks
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:37 +04:00
Cyrill Gorcunov
6472bdf545 fsnotify: Rename inotify_wd_info structure to fsnotify_mark_info
This structure will carry mark of any type.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:36 +04:00
Cyrill Gorcunov
be534b9ecc fsnotify: Move debug printing into get_mark_path
This prints out more details on what is going on.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:35 +04:00
Cyrill Gorcunov
5425da0b61 fanotify: Introduce get_mark_path helper
We will use it for fanotify objects restore, so to
eliminate code duplication make a separate helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:34 +04:00
Cyrill Gorcunov
f385d32da5 image: fanotify -- Add scaffold code for fanotify objects
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:32 +04:00
Cyrill Gorcunov
4629ecd391 protobuf: fsnotify -- Add fanotify entries
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:31 +04:00
Cyrill Gorcunov
78259da381 fsnotify: Add is_fanotify_link helper
Will need it to dump fanotify objects.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:30 +04:00
Cyrill Gorcunov
f58ab92cfe mount: Add lookup_mnt_id and lookup_mnt_sdev helpers
We will need to lookup mount points by mount id
and device for fanotify restore.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:28 +04:00
Cyrill Gorcunov
2d4a16c6ad syscall: Add __NR_fanotify_init and __NR_fanotify_mark
Will need them to restore fanotify objects.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:27 +04:00
Cyrill Gorcunov
b724096f0f fsnotify: Rename inotify files to fsnotify
We will be handling both inotify and fanotify
objects here thus to make less confusion rename
the files to fsnotify.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 18:34:26 +04:00
Andrey Vagin
456884ea8e zdtm.sh: exit with zero in case of success
A bash script exits with code of a last command,
so zdtm.sh return 1 if TMP_TREE is not initialized.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-15 17:57:45 +04:00
Andrey Vagin
64706655b6 zdtm: check SO_REUSEADDR is restored
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:47:26 +04:00
Andrey Vagin
b1abc3b21c restore: don't desable tcp repair mode twice
TCP repair mode should be disabled after unlocking connections.
Disabling of repair mode drops SO_REUSEADDR, so it should be restored.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:47:19 +04:00
Alexander Kartashov
effe3294d9 zdtm: added target architecture checks into FPU tests
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 18:27:52 +04:00
Pavel Emelyanov
6773090014 core: introduced the macro CORE_THREAD_INFO to access the machine-specific part of CoreEntry
This is the merge and a slight rework (no TI_SP macro) of Alexander's patches
about the subj.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 17:19:06 +04:00
Andrey Vagin
8018063933 zdtm.sh: execute all zdtm test case for a defined commit
This functionality can help to test a patch set:
for i in `git rev-list HEAD~15..HEAD`; do
	./test/zdtm.sh -c $i || break;
done

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:34 +04:00
Andrey Vagin
a19cf2be41 zdtm.sh: use another directory for a temporary crtools tree
It's more convinient for a few reasons
* don't need to recompile sources for each test case
* don't change the current tree

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:18 +04:00
Andrey Vagin
07f5c3fecf zdtm: compile a test before constructing a new root
A binary is required to get shared library dependencies

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:05 +04:00
Andrey Vagin
fb14f5d118 zdtm: remove mentions of test_init
test_init was removed a long ago

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:52:00 +04:00
Andrey Vagin
e513535b14 zdtm.sh: fix absolute path to crtools
zdtm.sh launched by an absolute path exits with an error due to
an incorrect path to crtools

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 15:51:54 +04:00
Cyrill Gorcunov
24887c6e9c log: Add generic __print_on_level helper
It accepts va_list argument and suitable to
be wrapped with another helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:26:18 +04:00
Cyrill Gorcunov
c406ccc06f log: Make pr_err_once to use pr_err
No need for core duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:26:07 +04:00
Cyrill Gorcunov
7dccef3ad4 log: Beautify log.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:25:59 +04:00
Alexander Kartashov
58f26c8fdd parasite-syscall.c: moved the function mmap_seized() to the file arch/x86/crtools.c
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-14 14:19:43 +04:00