提交 e6587cdb 编写于 作者: S Stefano Stabellini 提交者: Boris Ostrovsky

pvcalls-back: set -ENOTCONN in pvcalls_conn_back_read

When a connection is closing we receive on pvcalls_sk_state_change
notification. Instead of setting the connection as closed immediately
(-ENOTCONN), let's read one more time from it: pvcalls_conn_back_read
will set the connection as closed when necessary.

That way, we avoid races between pvcalls_sk_state_change and
pvcalls_back_ioworker.
Signed-off-by: NStefano Stabellini <stefanos@xilinx.com>
Reviewed-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
上级 d90a1ca6
......@@ -160,9 +160,10 @@ static void pvcalls_conn_back_read(void *opaque)
/* write the data, then modify the indexes */
virt_wmb();
if (ret < 0)
if (ret < 0) {
atomic_set(&map->read, 0);
intf->in_error = ret;
else
} else
intf->in_prod = prod + ret;
/* update the indexes, then notify the other end */
virt_wmb();
......@@ -288,7 +289,7 @@ static void pvcalls_sk_state_change(struct sock *sock)
return;
intf = map->ring;
intf->in_error = -ENOTCONN;
atomic_inc(&map->read);
notify_remote_via_irq(map->irq);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册