restore: use /proc/self/mountinfo for collecting mounts fo the root task (v3)

If the root task is forked in a new pidns, it can't use its pid for
accessing /proc, because this proc belongs to the source pidns.

v2: don't copy a static string.
v3: take a bright part of Tycho's patch

Reported-by: Tycho Andersen <tycho.andersen@canonical.com>
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
stats: Properly initialize dump stats

They all should be zeroed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
flock: Don't hide image read error on flocks restore

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
img: Add ability to check whether optional image collection happened

A bit later we'd need to check whether cinfo collector
opened an image or not due to file absense.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
flock: Merge all file lock entries into single image file

They are now in per-pid images, but every entry contains a
pid to which it "belongs". This belonging is fake -- it's
just a pid of a task who placed the lock, while locks really
belong to files. We even have a bug when task that locked
a file exited and "delegated" the lock to its child.

This images merge reduces the amount of image files criu
generates and may simplify the fix of mentioned above issue.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>