From 972aa90b75b832eb77ad25ae1f93189d672d6ad1 Mon Sep 17 00:00:00 2001 From: Max Vozeler Date: Wed, 12 Jan 2011 15:02:04 +0200 Subject: [PATCH] --- yaml --- r: 232609 b: refs/heads/master c: bd65f6233f6bc3233e7910752689fe3a45dc2e0c h: refs/heads/master i: 232607: c5428721d01ff88a19d3581a340574e13b6ad6c5 v: v3 --- [refs] | 2 +- trunk/drivers/staging/usbip/vhci_rx.c | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 6231e9560863..af3557a3ce48 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7e249c8b0737429bbf534515f81aded93504f449 +refs/heads/master: bd65f6233f6bc3233e7910752689fe3a45dc2e0c diff --git a/trunk/drivers/staging/usbip/vhci_rx.c b/trunk/drivers/staging/usbip/vhci_rx.c index ac15cea75396..bf6991470941 100644 --- a/trunk/drivers/staging/usbip/vhci_rx.c +++ b/trunk/drivers/staging/usbip/vhci_rx.c @@ -193,6 +193,19 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, return; } +static int vhci_priv_tx_empty(struct vhci_device *vdev) +{ + int empty = 0; + + spin_lock(&vdev->priv_lock); + + empty = list_empty(&vdev->priv_rx); + + spin_unlock(&vdev->priv_lock); + + return empty; +} + /* recv a pdu */ static void vhci_rx_pdu(struct usbip_device *ud) { @@ -210,8 +223,14 @@ static void vhci_rx_pdu(struct usbip_device *ud) if (ret < 0) { if (ret == -ECONNRESET) usbip_uinfo("connection reset by peer\n"); - else if (ret != -ERESTARTSYS) + else if (ret == -EAGAIN) { + /* ignore if connection was idle */ + if (vhci_priv_tx_empty(vdev)) + return; + usbip_uinfo("connection timed out with pending urbs\n"); + } else if (ret != -ERESTARTSYS) usbip_uinfo("xmit failed %d\n", ret); + usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); return; }