All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <dvrabel@cantab.net>
To: Wei Liu <wei.liu2@citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: netback Oops then xenwatch stuck in D state
Date: Wed, 13 Feb 2013 19:20:32 +0000	[thread overview]
Message-ID: <511BE780.9000707@cantab.net> (raw)
In-Reply-To: <1360780669.16636.94.camel@zion.uk.xensource.com>

On 13/02/13 18:37, Wei Liu wrote:
> A slightly upgraded version of the *UNTESTED* patch.
> 
> 
> Wei.
> 
> ----8<----
> commit df4c929d034cec7043fbd96ba89833eb639c336e
> Author: Wei Liu <wei.liu2@citrix.com>
> 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.

You also need to remove the netbk_tx_err() after checking the result of
netbk_count_requests().  Otherwise you will have a double xenvif_put(),
which will screw up ref counting.

I would also suggest returning -EINVAL from netbk_count_requests().

It not clear to me how this will fix the original oops though.

David

>     
>     Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> 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

  reply	other threads:[~2013-02-13 19:20 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 21:58 netback Oops then xenwatch stuck in D state Christopher S. Aker
2013-02-01 22:14 ` Andrew Cooper
2013-02-02  1:01 ` Wei Liu
2013-02-04 16:12   ` Christopher S. Aker
2013-02-04 17:37     ` Wei Liu
2013-02-10  5:30   ` Christopher S. Aker
2013-02-10 22:03     ` Christopher S. Aker
2013-02-11 11:45       ` Wei Liu
2013-02-11 16:17         ` Christopher S. Aker
2013-02-11 16:57           ` Wei Liu
2013-02-11 18:44             ` Christopher S. Aker
2013-02-12 14:59               ` Wei Liu
2013-02-12  9:58         ` Ian Campbell
2013-02-13  2:51           ` Christopher S. Aker
2013-02-13 12:47             ` Wei Liu
2013-02-13 20:12               ` Christopher S. Aker
2013-02-13 20:29                 ` Wei Liu
2013-02-13 16:40             ` Jan Beulich
2013-02-13 18:24             ` Wei Liu
2013-02-13 18:37               ` Wei Liu
2013-02-13 19:20                 ` David Vrabel [this message]
2013-02-13 19:39                   ` Wei Liu
2013-02-13 20:17                   ` Wei Liu
2013-02-14  9:11                     ` Jan Beulich
2013-02-14 11:20                       ` Wei Liu
2013-02-14 11:34                         ` Ian Campbell
2013-02-14 11:38                           ` Wei Liu
2013-02-14 11:50                             ` Jan Beulich
2013-02-14 11:56                               ` Wei Liu
2013-02-14 11:48                         ` Jan Beulich
2013-02-14 12:13                           ` Wei Liu
2013-02-14 12:33                             ` Jan Beulich
2013-02-14 12:40                               ` Wei Liu
2013-02-14 12:45                               ` Jan Beulich
2013-02-14 15:29                                 ` Jan Beulich
2013-02-14 15:38                                   ` Wei Liu
2013-02-14 12:20                           ` David Vrabel
2013-02-14 12:29                             ` Wei Liu
2013-02-14 12:38                               ` Ian Campbell
2013-02-14 12:47                               ` David Vrabel
2013-02-14 12:55                                 ` Wei Liu
2013-02-14 12:39                             ` Jan Beulich
2013-02-14 11:25                       ` David Vrabel
2013-02-14  9:14                 ` Jan Beulich
2013-02-14  9:25                   ` Jan Beulich
2013-02-14 10:57                   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=511BE780.9000707@cantab.net \
    --to=dvrabel@cantab.net \
    --cc=Ian.Campbell@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.