2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

50 Commits

Author SHA1 Message Date
Kir Kolyshkin
d64d68d66c whitespace-at-eol cleanup
Remove whitespace at EOL (found by git grep ' $')

To people using vim, I'd suggest adding the following code to ~/.vimrc:

let c_space_errors = 1
highlight FormatError ctermbg=darkred guibg=darkred
match FormatError /\s\+$\|\ \+\t\|\%80v.\|\ \{8\}/

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-12 10:00:45 +04:00
Cyrill Gorcunov
56f4679dfc fsnotify: Fix typo in get_mark_path debug output
@path is always nil here, we actually need @remap->path

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-04 17:36:04 +04:00
Cyrill Gorcunov
3f3439cd42 headers: Move fh_t to fsnotify.c
We really don't need it spread over all headers. The file
handlers are used in fsnotify only, declare it there.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-14 22:13:43 +04:00
Andrey Vagin
a434e7f075 crtools: move pid_rst_prio to pid.h
crtools.h is too heavy to be included in many sources

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 18:18:12 +04:00
Andrey Vagin
1300cf4915 crtools: move all stuff about fdset in a separate header
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:24:48 +04:00
Pavel Emelyanov
b978c6f873 util: Introduce buffer size for carrying /proc/self/fd/N path
There's ... a number of places where we want to do something
with /proc/self/fd/%d path. Each time we guess buffer size
that is enough for this. Make standard constant for this and
save some space on stack and drop args for some functions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:59:59 +04:00
Pavel Emelyanov
280b9e36bf inotify: Sanitize watches adding loop
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:45:32 +04:00
Pavel Emelyanov
d092c5ae65 inotify: Optimize ify search when collecting wd for it
CRIU puts wd-s for one inotify in one row (one after another),
so when collecting next wd, we can find the ify to attach them
to faster.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:40:45 +04:00
Pavel Emelyanov
cb576d892a inotify: Sort marks by wd before collecting them
The inotify_add_watch generates wd-s one-by one. We cannot
request for one, thus we call this syscall till the required
wd is generated.

Thus, if we want to restore several wd-s for an inotify, we
have to put them in ascending order. Otherwise we may restore
watch with higher wd earlier and will thus not be able to
generate the lower wd in a reasonable time.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:35:28 +04:00
Pavel Emelyanov
dc38364963 fsnotify: Print wd being restored for inotify
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:30:04 +04:00
Pavel Emelyanov
3f802388b3 fsnotify: Add comment saying why we attach watches via /proc/self/fd/
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:15:57 +04:00
Pavel Emelyanov
7eb20e7ddb fsnotify: Move decoding handle into function
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:13:58 +04:00
Pavel Emelyanov
7bb5ba1ffe fsnotify: Don't crash on bad fsnotify mark type
This can be broken image, need to handle this error gracefully.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:10:46 +04:00
Pavel Emelyanov
ccdcb3d39b fsnotify: Simplify get_mark_path code
Handle the simplest (remap) case early. This makes code
simpler and reduces one level of indent.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-15 13:05:50 +04:00
Cyrill Gorcunov
8a791d03f6 fsnotify: Add debug printing of the target link
Convenient for debug.

 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000000002 (via /proc/self/fd/5 -> /)
 | (00.005999)   3857: fsnotify:           Restore inotify watch for 0x00800002:0x0000000000083a93 (via /home/criu/test/zdtm/live/static/inotify-removed (deleted).cr.1.ghost)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-14 14:40:30 +04:00
Cyrill Gorcunov
537621d954 fsnotify: Use pr_perror on inotify_add_watch error path
To get more detailed error desciption. Also print watchdog
number if it exceed expected, for better error output.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 23:02:40 +04:00
Cyrill Gorcunov
7ed0609943 fsnotify: Align collect_image_info members assignments
It's a way more easier to read.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-10-10 23:02:06 +04:00
Pavel Emelyanov
b18fb09eb9 show: Replace one-line show_foo calls with args array
We have generic do_pb_show() call and tons of show_foo
routines, that just call one with proper args. Compact
the code by putting the args into array and calling
the do_pb_show() in one place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-24 04:00:32 +04:00
Pavel Emelyanov
84737e2796 build: Generate most of the pb-desc automatically
These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 21:47:31 +04:00
Pavel Emelyanov
60e6d38868 collect: Shorten common images collecting code
Now we have a set of cinfo-s, it's possible to collect all
this stuff in a plan for-loop.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:52:18 +04:00
Pavel Emelyanov
64e7d2435a collect: Reduce amount of args to collect_image call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:27:06 +04:00
Pavel Emelyanov
9917c4fe34 rst: Compact file-descs collects a bit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 01:06:58 +04:00
Pavel Emelyanov
d020ebb36d files: Compact the code by removing per-file dump helpers
Since *all* of them just call do_dump_gen_file with proper ops,
just call one directly. Compacts the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-14 00:11:08 +04:00
Pavel Emelyanov
add21b75c9 show: Remove options args from ->show callback
This thing is global, we can address one explicitly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 00:23:42 +04:00
Kir Kolyshkin
41c7ca8218 Fix typos in comments
This is less useful than fixing typos in output messages, but anyway.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:46 +04:00
Kir Kolyshkin
d90d4b1b88 Fix typos in log messages
Someone has to do it, right?..

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:25 +04:00
Cyrill Gorcunov
6586c4685c fsnotify: Don't fail on old versions where no inotify/fanotify image present
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-17 19:20:41 +04:00
Alexander Kartashov
3c16edc0bd cr: generalized format strings
This patch replaces the format specifier %ld with PRIx64
in the following places:

* the format string argument of the functions scanf() and printf(),
* in the macros GEN_SYSCTL_*_FUNC.

We need explicit specification of the integer size there.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-16 19:20:08 +04:00
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
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
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
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
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
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
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
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