From: Wei Liu Subject: Re: netback Oops then xenwatch stuck in D state Date: Thu, 14 Feb 2013 11:20:43 +0000 Message-ID: <1360840843.16636.109.camel@zion.uk.xensource.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> <511BE780.9000707@cantab.net> <20130213201725.GA1453@zion.uk.xensource.com> <511CB86702000078000BE1C5@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <511CB86702000078000BE1C5@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: David Vrabel , wei.liu2@citrix.com, Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Thu, 2013-02-14 at 09:11 +0000, Jan Beulich wrote: > >>> On 13.02.13 at 21:17, Wei Liu wrote: > > On Wed, Feb 13, 2013 at 07:20:32PM +0000, David Vrabel wrote: > >> On 13/02/13 18:37, Wei Liu wrote: > >> > A slightly upgraded version of the *UNTESTED* patch. > >> > > >> > > >> > Wei. > >> > > >> > ----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. > >> > >> 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 just realized that we were talking about different code path when I > > walked home. > > > > The path you mentioned is correct. As excution flow should never reach > > there if there is error in netbk_count_requests. > > > > The path I'm not sure is that in the netbk_fatal_tx_err, it calls > > xenvif_carrier_off which calls xenvif_put, and then it calls xenvif_put, > > which is likely to mess up the refcount. > > I first thought so too when looking at this again yesterday, but > then convinced myself that this double put _here_ is correct. And > Ian's patch specifically removed to call to netbk_tx_err() after the > caller netbk_count_requests() recognized the error, knowing that > the latter function now itself issues a call to netbk_fatal_tx_err() > (whether that wouldn't better have replaced the caller's call to > netbk_tx_err() is a different question). > I'm not convinced. netbk_tx_err only has one xenvif_put, however netbk_fatal_tx_err has two puts. If this is a bug, and, if my previous patch fixes Christopher's OOPS, he will hit this bug soon when shutting down DomU. Wei.