2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 22:35:33 +00:00

rst: only restore dgram socket queue once

In the case where there were multiple clients for a dgram socket, we were
restoring the queue for each client. Instead, we should pick one client and
she should restore the queue while the rest skip it.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Tycho Andersen
2015-07-22 17:51:26 -06:00
committed by Pavel Emelyanov
parent 03c2a0a632
commit 83f1f7e588

View File

@@ -638,6 +638,13 @@ struct unix_sk_info {
* after listen() if the socket is in TCP_LISTEN.
*/
futex_t prepared;
/*
* For DGRAM sockets with queues, we should only restore the queue
* once although it may be open by more than one tid. This is the peer
* that should do the queueing.
*/
u32 queuer;
};
#define USK_PAIR_MASTER 0x1
@@ -708,7 +715,7 @@ static int post_open_unix_sk(struct file_desc *d, int fd)
return -1;
}
if (restore_sk_queue(fd, peer->ue->id))
if (peer->queuer == ui->ue->ino && restore_sk_queue(fd, peer->ue->id))
return -1;
if (rst_file_params(fd, ui->ue->fown, ui->ue->flags))
@@ -1021,6 +1028,7 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base)
ui->name = NULL;
futex_init(&ui->prepared);
ui->queuer = 0;
ui->peer = NULL;
ui->flags = 0;
pr_info(" `- Got %#x peer %#x (name %s)\n",
@@ -1063,6 +1071,8 @@ int resolve_unix_peers(void)
}
ui->peer = peer;
if (!ui->queuer)
ui->queuer = ui->ue->ino;
if (ui == peer)
/* socket connected to self %) */
continue;