Commit 83f1f7e5 authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

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: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 03c2a0a6
...@@ -638,6 +638,13 @@ struct unix_sk_info { ...@@ -638,6 +638,13 @@ struct unix_sk_info {
* after listen() if the socket is in TCP_LISTEN. * after listen() if the socket is in TCP_LISTEN.
*/ */
futex_t prepared; 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 #define USK_PAIR_MASTER 0x1
...@@ -708,7 +715,7 @@ static int post_open_unix_sk(struct file_desc *d, int fd) ...@@ -708,7 +715,7 @@ static int post_open_unix_sk(struct file_desc *d, int fd)
return -1; 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; return -1;
if (rst_file_params(fd, ui->ue->fown, ui->ue->flags)) if (rst_file_params(fd, ui->ue->fown, ui->ue->flags))
...@@ -1021,6 +1028,7 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base) ...@@ -1021,6 +1028,7 @@ static int collect_one_unixsk(void *o, ProtobufCMessage *base)
ui->name = NULL; ui->name = NULL;
futex_init(&ui->prepared); futex_init(&ui->prepared);
ui->queuer = 0;
ui->peer = NULL; ui->peer = NULL;
ui->flags = 0; ui->flags = 0;
pr_info(" `- Got %#x peer %#x (name %s)\n", pr_info(" `- Got %#x peer %#x (name %s)\n",
...@@ -1063,6 +1071,8 @@ int resolve_unix_peers(void) ...@@ -1063,6 +1071,8 @@ int resolve_unix_peers(void)
} }
ui->peer = peer; ui->peer = peer;
if (!ui->queuer)
ui->queuer = ui->ue->ino;
if (ui == peer) if (ui == peer)
/* socket connected to self %) */ /* socket connected to self %) */
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment