From: "Jan Beulich" Subject: Re: netback Oops then xenwatch stuck in D state Date: Thu, 14 Feb 2013 09:14:17 +0000 Message-ID: <511CB8F902000078000BE1CC@nat28.tlf.novell.com> References: <510C3AA3.2090508@theshore.net> <50E3A390-C52B-476A-8B20-BADBA42F3775@theshore.net> <51181924.4050500@theshore.net> <1360583103.16636.29.camel@zion.uk.xensource.com> <1360663133.20449.123.camel@zakaz.uk.xensource.com> <511AFFC9.3050404@theshore.net> <1360779868.16636.92.camel@zion.uk.xensource.com> <1360780669.16636.94.camel@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1360780669.16636.94.camel@zion.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: wei.liu2@citrix.com, "Christopher S. Aker" Cc: Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 13.02.13 at 19:37, Wei Liu wrote: > A slightly upgraded version of the *UNTESTED* patch. Ack (albeit I'd slightly prefer -EINVAL or, for eventual debugging purposes, four distinct -Exxx values to be returned). Jan > ----8<---- > commit df4c929d034cec7043fbd96ba89833eb639c336e > Author: Wei Liu > Date: Wed Feb 13 18:17:01 2013 +0000 > > netback: fix netbk_count_requests > > There are two paths in the original code, a) test against work_to_do, b) > test > against first->size, could return 0 even when error happens. > > Simply return -1 in error paths should work. Modify all error paths to > return > -1 to be consistent. > > Signed-off-by: Wei Liu > > diff --git a/drivers/net/xen-netback/netback.c > b/drivers/net/xen-netback/netback.c > index 103294d..0e0162e 100644 > --- a/drivers/net/xen-netback/netback.c > +++ b/drivers/net/xen-netback/netback.c > @@ -913,13 +913,13 @@ static int netbk_count_requests(struct xenvif *vif, > if (frags >= work_to_do) { > netdev_err(vif->dev, "Need more frags\n"); > netbk_fatal_tx_err(vif); > - return -frags; > + return -1; > } > > if (unlikely(frags >= MAX_SKB_FRAGS)) { > netdev_err(vif->dev, "Too many frags\n"); > netbk_fatal_tx_err(vif); > - return -frags; > + return -1; > } > > memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), > @@ -927,7 +927,7 @@ static int netbk_count_requests(struct xenvif *vif, > if (txp->size > first->size) { > netdev_err(vif->dev, "Frag is bigger than frame.\n"); > netbk_fatal_tx_err(vif); > - return -frags; > + return -1; > } > > first->size -= txp->size; > @@ -937,7 +937,7 @@ static int netbk_count_requests(struct xenvif *vif, > netdev_err(vif->dev, "txp->offset: %x, size: %u\n", > txp->offset, txp->size); > netbk_fatal_tx_err(vif); > - return -frags; > + return -1; > } > } while ((txp++)->flags & XEN_NETTXF_more_data); > return frags; > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel