mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 09:10:10 +00:00
sk-queue: don't block on restore of socket queues
If a socket queue doesn't have a free space, a error should be returned, because nobody reads this socket. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ea20f5d221
commit
1ce1cca2ac
3 changed files with 18 additions and 1 deletions
17
sk-queue.c
17
sk-queue.c
|
|
@ -189,10 +189,20 @@ void show_sk_queues(int fd, struct cr_options *o)
|
|||
int restore_sk_queue(int fd, unsigned int peer_id)
|
||||
{
|
||||
struct sk_packet *pkt, *tmp;
|
||||
int ret, img_fd;
|
||||
int ret, img_fd, flags;
|
||||
|
||||
pr_info("Trying to restore recv queue for %u\n", peer_id);
|
||||
|
||||
flags = fcntl(fd, F_GETFL, 0);
|
||||
if (flags == -1) {
|
||||
pr_perror("Unable to get flags for %d", fd);
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) ) {
|
||||
pr_perror("Unable to set O_NONBLOCK for %d", fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
img_fd = open_image_ro(CR_FD_SK_QUEUES);
|
||||
if (img_fd < 0)
|
||||
return -1;
|
||||
|
|
@ -221,6 +231,11 @@ int restore_sk_queue(int fd, unsigned int peer_id)
|
|||
xfree(pkt);
|
||||
}
|
||||
|
||||
if (fcntl(fd, F_SETFL, flags) ) {
|
||||
pr_perror("Unable to restore flags for %d", fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
close(img_fd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ int restore_socket_opts(int sk, SkOptsEntry *soe)
|
|||
int ret = 0;
|
||||
struct timeval tv;
|
||||
|
||||
pr_info("%d restore sndbuf %d rcv buf %d\n", sk, soe->so_sndbuf, soe->so_rcvbuf);
|
||||
ret |= restore_opt(sk, SOL_SOCKET, SO_SNDBUFFORCE, &soe->so_sndbuf);
|
||||
ret |= restore_opt(sk, SOL_SOCKET, SO_RCVBUFFORCE, &soe->so_rcvbuf);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ TST_NOFILE = \
|
|||
sockets_spair \
|
||||
sockets_dgram \
|
||||
socket_queues \
|
||||
socket_queues02 \
|
||||
socket-tcp \
|
||||
ipc_namespace \
|
||||
selfexe00 \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue