cgroup: rename controller_entry to cg_member_entry

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Support ghost directories restore

If we have opened and rmdir-ed directory, the dump works OK
creating the ghost file and remap, but restore creates _file_
instead of directory.

Fix this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Add test for opened ghost directory

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Rename prepare_fs into restore_fs

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Split fs restore into prepare and restore

The prepare one will become more complicated soon.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Split open_reg_by_id into two parts

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Fix restoration of ghost cwd (and root)

When cwd is removed (it can be) we need to collect the respective
file_desc before starting opening any files to properly handle
ghost refcounts. Otherwise we will miss one refcount from the
cwd's on ghost, which in turn will either BUG inside ghost removal,
or will fail the cwd due to the respective dir being removed too
early.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Add test for cwd ghost directory

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Add test for cwd and opened ghost directory

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm/socket-tcpbuf: add shortcuts for RDWRing a specified size of data

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/socket-tcpbuf: add heartbeat to make blood flow in the connection

Otherwise the connection can be disconnected due to a timeout, because
the kernel may drop packets from a receive queue (RcvPruned in
/proc/net/netstat).

Half of buffers always stay in the socket, another half is circulated.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Pick up deleted unix socket test (v2)

CRIU doesn't support relative unix sockets paths, so
tune the test to use absolute.

(v2: Off-by-one spotted by Filipe)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Initialize remap->is_dir for linked remap (to false)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Don't fail on missing fs.img for zombies

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Don't unlink ghost directory

It will be rmdir-ed a bit later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Add 50K'th line in the source code

As per current top commit (9c0c23c0) the amount of code in CRIU
_without_ the contents of the test/ directory is

$ git grep -l . | egrep -v ^test | xargs wc -l
...
49999

This is the only chance for such a great one-liner :)

The place in the code is not completely random -- it's one of the
few occurrences of two consecutive empty lines in a .c file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Tested-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
tcp: don't forget to wake up the port->users futex

Reported-by: Robert Reinecke <reinecke@rbg.informatik.tu-darmstadt.de>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test/jenkins: add job to test pre-dump

Make pre-dump twice and then dump and restore.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
jenkins/btrfs: exclude inotify_irmap

Cyrill:  we exclude these tests because of braindamaged scheme
         btrfs uses for subvolume device numbering which we don't
	 yet support in inrmaps.

Test: zdtm/live/static/inotify_irmap, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/inotify_irmap, Namespace: 1
Dump log   : /mnt/btrfs/workspace/test/dump/inotify_irmap/16077/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.024342) Error (irmap.c:80): irmap: Can't stat /var/spool: No such file or directory
(00.024365) Error (irmap.c:80): irmap: Can't stat /lib/udev: No such file or directory
(00.024378) Error (irmap.c:80): irmap: Can't stat /no-such-path: No such file or directory
(00.024383) Error (fsnotify.c:184): fsnotify: Can't dump that handle
(00.024397) Error (cr-dump.c:1563): Dump files (pid: 16090) failed with -1
(00.024779) Error (cr-dump.c:1911): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
vdso: x86 -- Drop BUG_ON if no pfn found

If pfn = 0 it means we hit something very strange
condition but better to not yield BUG_ON here,
better exit with error for future investigation.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>