To test new bits we fetch from VmFlags smaps interface.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If we're provided with madivce() bits -- do
restore hits on VMA areas.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The kernel now supports providing VMA flags via smaps
interface so add pasting of them.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
On my testing machine these defs are not present
so define them where needed.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
According to Andrew's advice, change the close file logic a bit, to
make the code seems more readable.
Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Kinsbursky Stas added a comment - 24/Oct/12 4:24 PM
st_dev won't be the same. It's generated on each NFS superblock creation.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Get the info from kernel diag message (it should always be there)
and restore the shutdown at the very end.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Many image files opened by open_image_ro weren't closed before return, fix
them all in this patch.
Signed-off-by: Huang Qiang <h.huangqiang@huawei.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
sched_prio00 tests only priorities and sched_policy00
tests scheduling policy.
scheduling policy can not be changed in OpenVZ containers.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
getsid is required _XOPEN_SOURCE_EXTENDED,
it's enabled if __GNU_SOURCE is defined.
session00.c:92: error: implicit declaration of function 'getsid'
Signed-off-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It's a rudiment which not parsed well by all
gcc versions.
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
In case of errors it provides us more information about what is going on.
For example, in my test case I now can see where the error came from
| (00.027248) tty: Unpaired slave 0
| (00.027261) tty: Unpaired slave 2
| (00.027273) Error (tty.c:174): tty: Only one slave external peer is allowed (index 2)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
The kernel SO_BINDTODEVICE option is not symmetrical --
set required device name, but get reports index. Thus
need the index to name resolver.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It will be required to support socket bound to devices.
When restoring w/o net namespaces -- collect existing devices.
When restoring with them -- collect what is received from image.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
- Drop -c option from "dump" context,
it is no longer valid
- Add --link-remap, --shell-job options
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
In case if we've dumped a slave peer only (say a user dumped `top'
application) we should migrate it on current active terminal, which
barely an own standart stream prepared for us by the file engine.
Note only one external slave peer is allowed simply because
otherwise we can't distinguish which indices should be used
for each of them.
The patch basically does the following things
- Check if the SID present on peer exist in current
process tree, we need to be sure that we can restore
peer parameters and controlling terminal if present
- Rename pty_open_fake_ptmx to pty_open_unpaired_slave
because we might be inheriting SELF_STDIN_OFF instead
of opening fake master peer
- Do inherit SELF_STDIN_OFF and restore tty group if
we are restoring external tty
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We need to make sure that the only one external tty
is present, since otherwise we have no idea on which
pts index to connect them on restore.
This patch extends tty_verify_active_pairs procedure to
count how many external tty is present in the dump image.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Upon reception of tty we need to mark it in @tty_active_pairs
bitmam thus we will be able to verify if
- all active ttys obtained are paired
- if not paired then only one external tty is allowed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
If --shell-job passed we allow to dump and restpre session non-leaders.
Note that in sake of tty restore (which will be addressed in
further patches) we do inherit process group for root task.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This option will tells the tool to procceed dumping
even if a root task is not a session leader.
This implies that this option will allow to "migrate"
one external tty connection. Say a person may dump
"top" application in one bash shell and restore it
in another shell session.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We will need it for slave ttys migration. They serve for one purpose --
to clone self stdio descriptor and use it with tty layer, which will
be addressed in further patches.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Otherwise PRIO_PROCESS may be not found.
Reported-by: Andrew Grigorev <andrew@ei-grad.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
It should fit the sa_sigaction declaration, otherwise compiler
complains about uncasted assignments.
| restorer.c: In function тАШ__export_restore_taskтАЩ:
| restorer.c:318:20: error: assignment from incompatible pointer type [-Werror]
So just use siginfo_t here from the system signal.h header.
Signed-off-by: Andrew Grigorev <andrew@ei-grad.ru>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
No magic here, just fetch info using getpriority and sched_getxxx calls.
Good news is that the mentioned syscalls take pid as argument and do work
with it, i.e. -- no need in parasite help here.
Restore is splitted into prep -- copy sched bits from image on restorer
args -- and the restore itself. It's done to avoid restoring tasks info
with IDLE priority ;) To make restorer not-fail sched bits are validated
for sanity on prep stage.
Minimal sanity test is also there.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
We need to use namespace local sid/pgid parameters
assigned on tty link, thus use parasite helper.
Otherwise we might fail on restoring controlling
terminal inside namespace (though everything else
will work even without this patch).
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Since we've started fetching sid/pgid from the
dumpee context we're allowed to obtain sid/pgid
on a slave peer. This is perfectly valid. So
drop this test.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Some file-type specific parameters can be fetched with
parasite code only, so lets carry parasite control block
pointer in struct fd_parms.
This is a bit ugly but requires less code to touch and
enough for now. In long terms we need some more generalized
routine/hooks which would depends on file type.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Will need it to fetch tty link parameters. This is
because the kernel provides SID/PGID related to the
caller context, and if we're dumping the process inside
namespace -- we need local SID/PGIDs, not global ones.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
In case if here no task found which would restore
controlling terminal -- exit with error instead of
continue with just error message.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Currently the pretty format leaks to the nested messages and
affects the way they are shown. Fix this by assuming the nested
messages to be non-pretty.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
No need for memcpy here, it's plain integer value
which need to be filled.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This test set up two posix timers with different clocks: REALTIME and
MONOTONIC.
Both send signals.
Signals are disabled before suspend. This makes overrun counters increasing.
After restore tests enables signals, and make sure, that:
1) signal handler for both timers was called with proper arguments
2) time displacement for both timers is not greater than specified (10% by
default).
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: Vladimir Davydov <VDavydov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
A test allocates and filles one page, creates a new child, then
compares pfn-s for both processes.
v2: set a position on each iteration
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>