[CRIU] [PATCH v2 0/9] epoll: Add support for duped targets
Andrey Vagin
avagin at virtuozzo.com
Mon Jun 25 20:00:24 MSK 2018
This test doesn't pass my 5-minutes test
[root at fc24 criu]# python test/zdtm.py run -t zdtm/static/eventfs00
=== Run 1/1 ================ zdtm/static/eventfs00
======================== Run zdtm/static/eventfs00 in h ========================
Start test
./eventfs00 --pidfile=eventfs00.pid --outfile=eventfs00.out
Run criu dump
Run criu restore
=[log]=> dump/zdtm/static/eventfs00/36/1/restore.log
------------------------ grep Error ------------------------
(00.165038) 36: Create fd for 405
(00.165060) 36: epoll: Restore eventpoll-tfd: id 00000000 tfd 0x000052 events 0x00001d data 0xffffffffffffffff
(00.165106) 36: epoll: Restore eventpoll-tfd: id 00000000 tfd 0x000054 events 0x00001d data 0xffffffffffffffff
(00.165184) 36: epoll: Restore eventpoll-tfd: id 00000000 tfd 0x000054 events 0x00001d data 0xffffffffffffffff
(00.165232) 36: Error (criu/eventpoll.c:263): epoll: Can't add event on 0x000007: File exists
(00.165250) 36: Error (criu/files.c:1245): Unable to open fd=4 id=0x7
(00.165391) Error (criu/cr-restore.c:2395): Failed to wait inprogress tasks
(00.165493) Error (criu/cr-restore.c:2572): Restoring FAILED.
------------------------ ERROR OVER ------------------------
############### Test zdtm/static/eventfs00 FAIL at CRIU restore ################
##################################### FAIL #####################################
On Wed, Jun 20, 2018 at 08:01:38PM +0300, Cyrill Gorcunov wrote:
> We need to support a case where file has been added into
> epoll, then duped into some other number, and finally
> the former one is closed. So that epoll fdinfo will
> print no longer existing fd number (in this series
> we will find which new file is matching the target).
>
> v2:
> - fix scm unix on the fly (we dont support them yet)
>
> Cyrill Gorcunov (9):
> kcmp: Cleanup sources
> kcmp: Beautify kcmp-ids.h
> kcmp: Drop empty line at EOF
> kcmp: Add epoll definitions
> epoll: kdat -- Check if we have KCMP_EPOLL_TFD support
> epoll: Pass drained fds to dump_one_file
> epoll: Use real file transferred for target fds check
> epoll: Use kcmp to find proper target file
> test: eventfs00 -- Extend to test duped fd
>
> criu/eventpoll.c | 119 +++++++++++++++++++++++++++++++++++++++++--
> criu/files.c | 8 +--
> criu/include/files.h | 2 +
> criu/include/kcmp-ids.h | 29 ++++++-----
> criu/include/kcmp.h | 10 ++++
> criu/include/kerndat.h | 1 +
> criu/kcmp-ids.c | 14 +++--
> criu/kerndat.c | 48 +++++++++++++++++
> test/zdtm/static/eventfs00.c | 23 +++++++--
> 9 files changed, 224 insertions(+), 30 deletions(-)
>
> --
> 2.14.4
>
-------------- next part --------------
diff --git a/test/zdtm/static/eventfs00.c b/test/zdtm/static/eventfs00.c
index 61d26e90b..7261050db 100644
--- a/test/zdtm/static/eventfs00.c
+++ b/test/zdtm/static/eventfs00.c
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
int efd, ret, epollfd, fd;
uint64_t v = EVENTFD_INITIAL;
struct epoll_event ev;
+ int i;
test_init(argc, argv);
@@ -55,33 +56,36 @@ int main(int argc, char *argv[])
memset(&ev, 0xff, sizeof(ev));
ev.events = EPOLLIN | EPOLLOUT;
- if (pipe(pipefd1) || pipe(pipefd2)) {
- fail("pipe");
- exit(1);
- }
-
- test_msg("epoll %d add %d native\n", epollfd, pipefd1[0]);
- if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pipefd1[0], &ev)) {
- fail("epoll_ctl");
- exit(1);
+ for (i = 0; i < 100; i++) {
+ if (pipe(pipefd1) || pipe(pipefd2)) {
+ fail("pipe");
+ exit(1);
+ }
+
+ test_msg("epoll %d add %d native\n", epollfd, pipefd1[0]);
+ if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pipefd1[0], &ev)) {
+ fail("epoll_ctl");
+ exit(1);
+ }
+
+ fd = dup2(pipefd2[0], 999);
+ if (fd < 0) {
+ fail(" dup on pipe");
+ exit(1);
+ }
+
+ test_msg("epoll %d add %d dup'ed from %d\n", epollfd, fd, pipefd2[0]);
+ if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev)) {
+ fail("epoll_ctl on duped pipe");
+ exit(1);
+ }
+ close(fd);
+ test_msg("epoll source %d closed\n", fd);
+
+
+ test_msg("created eventfd with %"PRIu64"\n", v);
}
- fd = dup2(pipefd2[0], 64);
- if (fd < 0) {
- fail(" dup on pipe");
- exit(1);
- }
-
- test_msg("epoll %d add %d dup'ed from %d\n", epollfd, fd, pipefd2[0]);
- if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev)) {
- fail("epoll_ctl on duped pipe");
- exit(1);
- }
- close(fd);
- test_msg("epoll source %d closed\n", fd);
-
- test_msg("created eventfd with %"PRIu64"\n", v);
-
ret = write(efd, &v, sizeof(v));
if (ret != sizeof(v)) {
fail("write");
More information about the CRIU
mailing list