2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 08:45:49 +00:00
Commit Graph

7701 Commits

Author SHA1 Message Date
Andrei Vagin
f830e0ff34 mount: clone a mount namespace to open a detached mount
If we can't create a temporary directory for a detached mount,
we can clone a whole mount namespace, open a mount and release
the created namespace. The result will be the same.

https://jira.sw.ru/browse/PSBM-57135
https://github.com/opencontainers/runc/issues/1202
travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-01 21:58:26 +03:00
Andrei Vagin
3cedb6183a mount: create a slave pty if it has to be bind-mounted to somewhere
Now we create pty pairs when file descriptors are restored.
The problem is that a slave tty can be bind-mounted to somewhere
and in this case we have to create this pair and hold a master file
descritore before related file descriptors will not be restored.

In this patch, a unix socket is used to hold file descriptros.
And we use SK_PEEK_OFF and MSG_PEEK to get any of them.

travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-01 21:58:26 +03:00
Andrei Vagin
7dc7030d90 fdstore: add synchronization to protect a peek offset
When we need to get a file descriptor, we have to set peek offset
and then to peek a message. There are two system calls, so we need
to be sure that nobody changes a socket peek offset after we set it.

Acked-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-01 21:58:26 +03:00
Andrei Vagin
4d06aa12bb fdstore: add a storage for file descriptors (v2)
We need a storage for file descriptors which is shared between processes
and doesn't use a lot of file descriptors. We are going to use it on
restore and if it will use file descriptors, we will have to find
descriptors which don't used by all restored processes to not confilict
with their descriptors.

There are two solutions. The first one is a service (process) which
handles to command push_fd(id, fd) and pop_fd(id, fd).

Another solution is to save descriptros in a unix socket.  It requires
only one extra descriptor which we can register as a service fd. Each
unix socket has a buffer and can fit a number of file descriptros. We
can use SK_PEEK_OFF and MSG_PEEK to get file descriptros from a socket
as many times as we need.

This patch implements the second solution.

v2: call recvmsg with MSG_PEEK
travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-01 21:58:25 +03:00
Andrei Vagin
6afe523d97 tty: notify about orphan tty-s via rpc
Now Docker creates a pty pair from a container devpts to use is as console.
A slave tty is set as a control tty for the init process and bind-mounted
into /dev/console. The master tty is handled externelly.

Now CRIU can handle external resources, but here we have internal resources
which are used externaly.

https://github.com/opencontainers/runc/issues/1202
travis-ci: success for A few fixes to c/r a docker container with a console (rev3)
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-03-01 21:58:02 +03:00
Pavel Emelyanov
e4f60eee8b criu: Version 2.11.1
In 2.11 we've had several got bronek:

- page-server start via RPC
- Fedora build
- ppc64le restorer switch

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2.11.1
2017-02-17 14:28:05 +03:00
Kir Kolyshkin
01e475a6a0 Fix Fedora build (undo _FORTIFY_SOURCE for pie)
Recent Fedora releases add -Wp,-D_FORTIFY_SOURCE=2 to rpm builds,
which breaks compiling pie code on some architectures due to its
trying to use (absent) memcpy_chk() instead of usual memcpy().

We must stand strong against FORTIFY_SOURCE in pie code.
No pasaran! Viva la resistance!

NOTE: in tests, FORTIFY_SOURCE is disabled for completely different
reasons (see commit d1a36cc9 for details), so we're not touching it.

[v2: resend the correct (latest) version]

Reported-by: Reported-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-17 13:33:49 +03:00
Laurent Dufour
17366e2ec1 ppc64: Fix clobber list item for JUMP_TO_RESTORER_BLOB
The JUMP_TO_RESTORER_BLOB assembly macro has been rewrote through the
commit '89d6b39cfe36 ppc64: pie -- Add ppc64le relocation's
processing', but the Clobber list hasn't been updated.

This doesn't generate build neither runtime errors since the Clobber
list was larger than needed but GCC 7 is now raising an error when an
assembly macro is clobbering the r2 register.

This patch fix the Clobber list to just modified registers.

Fixes: 89d6b39cfe ("ppc64: pie -- Add ppc64le relocation's processing")
Reported-by: Adrian Reber <adrian@lisas.de>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-17 13:33:35 +03:00
Pavel Emelyanov
56138fea8c service: Fix page-server start return code checking
Commit 10801f36 (page-server: don't return a server pid from
page-server) broke page-server starting via RPC -- the latter
code checks for return value being <=0 as failure.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-02-17 13:33:01 +03:00
Pavel Emelyanov
8719b7c99d criu: Version 2.11
This is a bugfix-mostly release. Interesting new features include
the huge rework of files restoring engine which fixed us bugs we
haven't seen in reality :) but have proven they exist. Als this
rework opens the way for scm-rigts c/r we need for nginx.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
v2.11
2017-02-13 11:23:08 +03:00
Adrian Reber
853391e5a0 RPC: make status-fd option available via RPC
As runc uses the RPC interface to run criu it is necessary to expose
the newly added status-fd feature via RPC. Using the status-fd interface
makes it possible to use lazy migration with runc.

travis-ci: success for RPC: make status-fd option available via RPC (rev3)
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-09 19:03:53 +03:00
Cyrill Gorcunov
ffc288fb42 compel: piegen -- Add @uapi-dir option
We will need it to include types once compel
gets into own directory.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-08 10:51:31 +03:00
Cyrill Gorcunov
3da3d8183f criu: arch,x86 -- Use stdint in fpu
Will move the header into compel.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2017-02-08 10:46:19 +03:00
Adrian Reber
7ac2d79ceb xsave: check for X86_FEATURE_OSXSAVE rather than for X86_FEATURE_XSAVE
Migrating a process between a system with the 'xsave' CPU flag and
another system without the 'xsave' CPU flags is not possible and
fails during restore. To avoid this situation it is possible to boot
the source system of the migration with 'noxsave' kernel command-line.

Unfortunately criu currently tries to detect the presence of 'xsave'
with the macro X86_FEATURE_XSAVE which represents the features of
the CPU without taking into account if the operating system has
disabled 'xsave'. Checking for 'xsave' availability with the macro
X86_FEATURE_OSXSAVE detects correctly if Linux has been booted
with disabled 'xsave' and thus migrating processes between hosts
with and without 'xsave' is possible if the kernel uses the flag
'noxsave'.

travis-ci: success for criu dump fails when using noxsave (rev2)
Signed-off-by: Adrian Reber <areber@redhat.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-07 19:36:16 +03:00
Pavel Emelyanov
730d374aed pie: Print timestamps in restorer
Nowadays we have parasite and restorer logs just start with pie:
prefix. Let's add timestamps in restorer too.

For parasite adding timestamps would require passing the start
timeval through the libcompel which is not (yet) clear how to do.

travis-ci: success for pie: Print timestamps in restorer
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 18:24:06 +03:00
Pavel Emelyanov
5d47738ad0 pagemap: Support async pages reading by chunks (v2)
When we collect all the read_page requests into one big preadv
call, the latter one may not read all the data in one go and
return less bytes read, than requested.

This is valid and already met in a bug :) So advance the iovec
set with the ret value and continue reading.

v2: Compilation fix on arm-s
    A little bit more debugging

https://github.com/xemul/criu/issues/271

travis-ci: success for series starting with [1/2] pagemap: Support async pages reading by chunks (v2)
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:33 +03:00
Andrei Vagin
6267e26720 mount: simplify mnt_build_ids_tree()
This patch reworks this function, removes mess and fix
the next coverity issue:

394                m->parent = parent;
CID 175314 (#1 of 1): Dereference after null check (FORWARD_NULL)
27. var_deref_model: Passing null pointer &parent->children to list_add_tail, which dereferences it. [show details]

travis-ci: success for mount: simplify mnt_build_ids_tree()
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:33 +03:00
Andrei Vagin
10dc2a5c36 zdtm: use pr_err if errno isn't required
205             if (fd < 0) {
>>> >>>     CID 175317:    (PW.BAD_PRINTF_FORMAT_STRING)
>>> >>>     invalid format string conversion
206                     pr_perror("can't accept client connection %m");

travis-ci: success for zdtm: use pr_err if errno isn't required
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:33 +03:00
Andrei Vagin
63b459a2ab unix: don't leak a file descriptor
1359            if (prep_unix_sk_cwd(ui, &cwd_fd, &root_fd))
>>> >>>     CID 175319:  Resource leaks  (RESOURCE_LEAK)
>>> >>>     Handle variable cwd_fd going out of scope leaks the handle.

travis-ci: success for unix: don't leak a file descriptor
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:33 +03:00
Kirill Tkhai
3649d94c1d files: Fix not populated helper ids
Every task and helper have ids populated, except this case.
Fix that.

https://travis-ci.org/tkhai/criu/builds/197728925

travis-ci: success for files: Fix not populated helper ids
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:33 +03:00
Andrei Vagin
dc20252049 travis: fix collecting code coverage
The problem is in the chroot test:
geninfo: ERROR: /home/travis/build/xemul/criu/test/zdtm/static/chroot.dir.test/home/travis/build/xemul/criu/images/timer.gcno: could not open file

We can just ignore these errors.

travis-ci: success for travis: fix collecting code coverage
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Andrei Vagin
10801f3632 page-server: don't return a server pid from page-server
This patch fixes an exit code if a page-server is started
as a daemon. Now the criu exits with a pid of a page server,
it's meaningless, because pid is usually bigger than 128.

travis-ci: success for series starting with [1/2] page-server: don't return a server pid from page-server
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Andrei Vagin
78d7cf92c7 namespace: use ferror() to detect errors of fscanf()
Currently we check errno, but musl-libc doesn't zero it,
if fscanf() has returned EOF without errors.

travis-ci: success for A few fixes for Alpine Linux
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Andrei Vagin
8e93583d28 criu: user raw syscalls for sched_getscheduler and sched_getparam
They are not implemented in musl-libc (alpine).

travis-ci: success for A few fixes for Alpine Linux
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Kirill Tkhai
b4e2768298 eventpoll: Fix dependency check
In the case when one eventpoll in polled by another eventpoll,
we should wait till the polled epoll is opened. So, as the stage
FLE_RESTORED is after FLE_OPEN, it's also OK.

travis-ci: success for eventpoll: Fix dependency check
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Kirill Tkhai
a80aba144a files: Do not lost original errno value
The callers of rfi_remap() are interested in a errno,
linkat_hard() returns. So, preserve errno before we
call rm_parent_dirs().

Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Andrei Vagin
1c478a2e48 tty: split pty_open_ptmx_index()
We are going to create slave pty-s to bind-mount them,
but at this moment we don't have file_desc-s and actually
can't open /dev/ptmx by path.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Andrei Vagin
129b18d375 unix: switch into the root mount namespace before cleaning stale sockets
Absolute paths are used to delete old unix sockets. After 3f67731b8e
all processes live in a mount root yard, so if we want to access
absolute paths, we have to change root.

https://travis-ci.org/avagin/criu/builds/197092365
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Kirill Tkhai
096dc1448d files: Use non-block __recv_fds() in recv_fd_from_peer()
Save one syscall and analyze recvmsg() error code to check
that there is no data in the socket.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Pavel Emelyanov
15ac89db80 files: Compact the expecten/not-expected branches in recv_fd_from_peer
As a slight side effect even expected fle is checked for being
task_fle(), but that's OK.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Pavel Emelyanov
958dbacdf2 files: Turn goto loop into while() one
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Pavel Emelyanov
15676f6dad files: Re-use keep_fd_for_future wider
The tail of the recv_fd_from_peer() matches this routine :)
So call one and rename, since it no longer keeps fd for
future only.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
2017-02-06 14:09:32 +03:00
Pavel Emelyanov
2ecf202375 files: Fix fle to be checked for being task_fle
We've received tmp, which is not expected one, so check for it.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
2017-02-06 14:09:31 +03:00
Andrei Vagin
2e8970beda mount: create a mount point for the root mount namespace in the roots yard
These chnages allows us to:
* avoid difference between the root mount namespace and other mount namespaces
* support a read-only root mount
* don't create temporary directories in the root mount

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:15 +03:00
Kirill Tkhai
b20780d6a0 files: Fix test and set endianess problem
Andrew Vagin reported the problem found by a checker:

    CID 174702 (#1 of 1): Out-of-bounds access (INCOMPATIBLE_CAST)
    incompatible_cast: Pointer &f->raw.counter points to an object whose
    effective type is int (32 bits, signed) but is dereferenced as a wider
    unsigned long (64 bits, unsigned). This may lead to memory corruption.

It looks like, this points to real problem, which may happen on big-endian
platforms. In the code I relay on the fact, that FDS_EVENT_BIT has a small
number and the value, it determines, fits into int type without problems.
But it's correct only for little-endian.

In case of big-endian, if the word size is 8 bytes, then FDS_EVENT value
is in the last bytes, so there is an access to wrong memory.

To fix the problem, I suggest to use little-endian byte order to work
with task_st futex. Then, the bits from 0 to 31 will be in the low adresses,
i.e. in task_st futex. There is new primitives test_and_set_bit_le() and
set_bit_le() borrowed from the linux kernel for that.

This fixes the problem, but I suppose, the checker does not see the problem
so deep, and just compares the types size, so it will fail again.
So, let's enlarge the bit field size to silence it.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:15 +03:00
Kirill Tkhai
74a87aba9f tty: Optimize dependencies check
Iterate over currently unrestored files only.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:15 +03:00
Kirill Tkhai
e98c96ed4a files: Merge collect_gen_fd() and collect_used_fd(), and call it unconditionally
Since we keep files of all types in a single list (fds), it's possible
to use only function for that and to call it unconditionally.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:15 +03:00
Kirill Tkhai
6072bca687 files: Kill pid parameter of open_fdinfos()
Nobody uses pid, so let's kill it. Also, pass pstree_item parameter
to open_fdinfos() instead of list, as this function operates on fds
list only.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
2a93e371c2 eventpoll: Use generic list for eventpoll files
Since eventpoll opening time is set by dependencies
(see epoll_not_ready_tfd()), we may safely store them
in generic list.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
f8143fd99b tty: Use generic list for tty files
Since tty opening order is set by dependencies,
we may safely store all ttys in generic list.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
f139581a06 files: Move ctty fixup to open_fd()
Fixup ctty right after it's open. It'll need for
merging tty files in single fds list: set ctty
before next fle in list is processed. See next
patch for the details.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
3432e9891c tty: Set dependencies between masters, slaves and ctty
Firstly masters, then slaves and lastly ctty.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
a14eedc22d files: Kill struct file_desc_ops::post_open
This make open fds asynchronous. Now we restore them in a poll-style.
Every ->open callback operates like a poll. It returns 1, i.e. "call me again",
if some events have not received yet, or 0, if restoring of a fle
has finished.

We iterate over list of file descriptors and look at its return value.
If there were not progress in restoring of a fle, we sleep on task_st
futex. As all events are sent together with changing task_st, we will
be woken up, when there is a some new work for us.

v6: Add a comment about open method return values

v5: Clear FDS_EVENT every beginning of cycle.
    Use 0, -1 and 1 for successful return error and "again" request.

v4: unix: 1)standalone sockets return ORV_AGAIN after first open
            to reopen fd by generic code
          2)do not call post_open_unix_sk() for !standalone sockets
    inet, epoll: return ORV_AGAIN after first open to reopen fd by generic code
    autofs: iterate used list instead of fds list

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
839078f8d2 files: Make recv_fd_from_peer() non-block
This breaks everything, because files.c can't have
a deal with this yet. But next patch will teach it.

v5: Use hard-coded 0, -1 and 1 for successful return,
error and "again" request.

v4: tty: merge new_fd assignment to receive_tty()
    and return this function result directly.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
96946ee906 files: Add new_fd parameter to file_desc_ops::open()
Return results of work separate: a new fd is in a parameter,
a status is in return value.

In next patches we will use return value "1" to indicate,
that open callback should be called once again, and restore
for this fle has not finished yet. So, we need to be able
to differ file descriptor with number 1 and "again" request.
We do not use negative value like -2 for this purpose,
because we want to allow fles to be served out before
they are completelly restored. So, if a fle is successefuly open,
but it's need one more call of open to complete its restore,
then we return 1 and populate new_fd in not negative value.
See "files: Kill struct file_desc_ops::post_open" for the details.

Also, export open_pipe()

v5: Use 0 and -1 for successful return and error.
v6: Rebase on new criu

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
7395c48609 files: Set fds event after sending fd to peer
This is need to make receiving a fle non-blocking.
We will sleep on task_st futex instead of this.

v5: Do not set event in send_fd_to_self()

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
118f1b6c6f eventpoll: Make post_open stage may fail
Currently, it's just an additional check. But later this will be used
int the following way. Return value "1" means, that fle is not ready
for restore, and the caller should recall this method once again later.
See "[PATCH] files: Kill struct file_desc_ops::post_open" for the details.

v5: Use "1" for return

v2: Use generic FLE_OPEN and FLE_RESTORED to determ if a fle is ready

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
7574028129 files: BUG on reopening already opened fle
This point we think it's a first call of open(),
so the state must be FLE_INITIALIZED.

v6: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:14 +03:00
Kirill Tkhai
5688335c71 timerfd: Kill post_open stage
Timerfd's post_open state does not depend on another objects,
so it may be safely merged into open stage.

travis-ci: success for Rework file opening scheme to make it asynchronous (rev5)
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:13 +03:00
Kirill Tkhai
7888646833 inet: Use task_st futex for notification instead of per-port
The step to make file opening use the only futex.

travis-ci: success for Rework file opening scheme to make it asynchronous (rev5)
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 14:09:13 +03:00