summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefano Stabellini <sstabellini@kernel.org>2018-12-21 15:06:33 -0800
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2019-01-02 11:00:38 -0500
commite6587cdbd732eacb4c7ce592ed46f7bbcefb655f (patch)
tree936d4b9222a32d2ee49c6f183124b1bffb6bcdae /drivers
parentd90a1ca60a1eccb4383fe203c76223ab4c0799ed (diff)
downloadlinux-e6587cdbd732eacb4c7ce592ed46f7bbcefb655f.tar.gz
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: Stefano Stabellini <stefanos@xilinx.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/pvcalls-back.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index 2e5d845b5091..71b628774c6f 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -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);
}