diff options
| author | Stefano Stabellini <sstabellini@kernel.org> | 2018-12-21 18:06:29 -0500 |
|---|---|---|
| committer | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2019-01-02 10:59:48 -0500 |
| commit | b79470b64fa9266948d1ce8d825ced94c4f63293 (patch) | |
| tree | 096e3cb80f128bbf7ed320f8141c13975a2d4d59 | |
| parent | 58f9d806d16a38ed3bae11e2ada83393436a4956 (diff) | |
pvcalls-front: read all data before closing the connection
When a connection is closing in_error is set to ENOTCONN. There could
still be outstanding data on the ring left by the backend. Before
closing the connection on the frontend side, drain the ring.
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>
| -rw-r--r-- | drivers/xen/pvcalls-front.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c index 77224d8f3e6f..e5d95aab2cb8 100644 --- a/drivers/xen/pvcalls-front.c +++ b/drivers/xen/pvcalls-front.c | |||
| @@ -560,15 +560,13 @@ static int __read_ring(struct pvcalls_data_intf *intf, | |||
| 560 | error = intf->in_error; | 560 | error = intf->in_error; |
| 561 | /* get pointers before reading from the ring */ | 561 | /* get pointers before reading from the ring */ |
| 562 | virt_rmb(); | 562 | virt_rmb(); |
| 563 | if (error < 0) | ||
| 564 | return error; | ||
| 565 | 563 | ||
| 566 | size = pvcalls_queued(prod, cons, array_size); | 564 | size = pvcalls_queued(prod, cons, array_size); |
| 567 | masked_prod = pvcalls_mask(prod, array_size); | 565 | masked_prod = pvcalls_mask(prod, array_size); |
| 568 | masked_cons = pvcalls_mask(cons, array_size); | 566 | masked_cons = pvcalls_mask(cons, array_size); |
| 569 | 567 | ||
| 570 | if (size == 0) | 568 | if (size == 0) |
| 571 | return 0; | 569 | return error ?: size; |
| 572 | 570 | ||
| 573 | if (len > size) | 571 | if (len > size) |
| 574 | len = size; | 572 | len = size; |
