Commit e931c757 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Make reuse crit section wider

This lock will have to be moved into the libsocr which is
not nice, so pull this out of the restore_tcp_queues.

And, since we're extending the section anyway, pull it away
from sk-tcp.c at all. Makes the code a little bit cleaner.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 947358a9
......@@ -74,7 +74,6 @@ extern int restore_one_tcp(int sk, struct inet_sk_info *si);
#define SK_EST_PARAM "tcp-established"
extern int check_tcp(void);
extern mutex_t *inet_get_reuseaddr_lock(struct inet_sk_info *ii);
struct task_restore_args;
int prepare_tcp_socks(struct task_restore_args *);
......
......@@ -589,8 +589,12 @@ static int open_inet_sk(struct file_desc *d)
goto err;
}
if (restore_one_tcp(sk, ii))
mutex_lock(&ii->port->reuseaddr_lock);
if (restore_one_tcp(sk, ii)) {
mutex_unlock(&ii->port->reuseaddr_lock);
goto err;
}
mutex_unlock(&ii->port->reuseaddr_lock);
goto done;
}
......@@ -751,8 +755,3 @@ int inet_connect(int sk, struct inet_sk_info *ii)
return 0;
}
mutex_t *inet_get_reuseaddr_lock(struct inet_sk_info *ii)
{
return &ii->port->reuseaddr_lock;
}
......@@ -525,7 +525,7 @@ static int send_tcp_queue(int sk, int queue, u32 len, struct cr_img *img)
return __send_tcp_queue(sk, queue, len, img);
}
static int restore_tcp_queues(int sk, TcpStreamEntry *tse, struct cr_img *img, mutex_t *reuse_lock)
static int restore_tcp_queues(int sk, TcpStreamEntry *tse, struct cr_img *img)
{
u32 len;
......@@ -552,17 +552,11 @@ static int restore_tcp_queues(int sk, TcpStreamEntry *tse, struct cr_img *img, m
* they can be restored without any tricks.
*/
len = tse->unsq_len;
mutex_lock(reuse_lock);
tcp_repair_off(sk);
if (len && __send_tcp_queue(sk, TCP_SEND_QUEUE, len, img)) {
mutex_unlock(reuse_lock);
if (len && __send_tcp_queue(sk, TCP_SEND_QUEUE, len, img))
return -1;
}
if (tcp_repair_on(sk)) {
mutex_unlock(reuse_lock);
if (tcp_repair_on(sk))
return -1;
}
mutex_unlock(reuse_lock);
return 0;
}
......@@ -645,7 +639,7 @@ static int restore_tcp_conn_state(int sk, struct inet_sk_info *ii)
if (restore_tcp_opts(sk, tse))
goto err_c;
if (restore_tcp_queues(sk, tse, img, inet_get_reuseaddr_lock(ii)))
if (restore_tcp_queues(sk, tse, img))
goto err_c;
if (tse->has_nodelay && tse->nodelay) {
......
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