Skip to content

Commit b79470b

Browse files
sstabelliniBoris Ostrovsky
authored andcommitted
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>
1 parent 58f9d80 commit b79470b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/xen/pvcalls-front.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,13 @@ static int __read_ring(struct pvcalls_data_intf *intf,
560560
error = intf->in_error;
561561
/* get pointers before reading from the ring */
562562
virt_rmb();
563-
if (error < 0)
564-
return error;
565563

566564
size = pvcalls_queued(prod, cons, array_size);
567565
masked_prod = pvcalls_mask(prod, array_size);
568566
masked_cons = pvcalls_mask(cons, array_size);
569567

570568
if (size == 0)
571-
return 0;
569+
return error ?: size;
572570

573571
if (len > size)
574572
len = size;

0 commit comments

Comments
 (0)