Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758412AbcLADhI (ORCPT ); Wed, 30 Nov 2016 22:37:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48088 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754554AbcLADhH (ORCPT ); Wed, 30 Nov 2016 22:37:07 -0500 Subject: Re: [PATCH net] vhost_net: don't continue to call the recvmsg when meet errors To: "Michael S. Tsirkin" References: <1480507857-22976-1-git-send-email-wangyunjian@huawei.com> <20161130152004-mutt-send-email-mst@kernel.org> <34EFBCA9F01B0748BEB6B629CE643AE60B0A7B68@szxeml561-mbx.china.huawei.com> <20161201051207-mutt-send-email-mst@kernel.org> <20161201052657-mutt-send-email-mst@kernel.org> Cc: wangyunjian , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , caihe From: Jason Wang Message-ID: <936954dd-c8a5-c0f6-c3b0-84a9d67329f5@redhat.com> Date: Thu, 1 Dec 2016 11:37:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161201052657-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 01 Dec 2016 03:37:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2101 Lines: 59 On 2016年12月01日 11:27, Michael S. Tsirkin wrote: > On Thu, Dec 01, 2016 at 11:26:21AM +0800, Jason Wang wrote: >> > >> > >> >On 2016年12月01日 11:21, Michael S. Tsirkin wrote: >>> > >On Thu, Dec 01, 2016 at 02:48:59AM +0000, wangyunjian wrote: >>>>> > > > >-----Original Message----- >>>>> > > > >From: Michael S. Tsirkin [mailto:mst@redhat.com] >>>>> > > > >Sent: Wednesday, November 30, 2016 9:41 PM >>>>> > > > >To: wangyunjian >>>>> > > > >Cc:jasowang@redhat.com;netdev@vger.kernel.org;linux-kernel@vger.kernel.org; caihe >>>>> > > > >Subject: Re: [PATCH net] vhost_net: don't continue to call the recvmsg when meet errors >>>>> > > > > >>>>> > > > >On Wed, Nov 30, 2016 at 08:10:57PM +0800, Yunjian Wang wrote: >>>>>> > > > > >When we meet an error(err=-EBADFD) recvmsg, >>>>> > > > >How do you get EBADFD? Won't vhost_net_rx_peek_head_len >>>>> > > > >return 0 in this case, breaking the loop? >>>> > > >We started many guest VMs while attaching/detaching some virtio-net nics for loop. >>>> > > >The soft lockup might happened. The err is -EBADFD. >>>> > > > >>> > >OK, I'd like to figure out what happened here. why don't >>> > >we get 0 when we peek at the head? >>> > > >>> > >EBADFD is from here: >>> > > struct tun_struct *tun = __tun_get(tfile); >>> > >... >>> > > if (!tun) >>> > > return -EBADFD; >>> > > >>> > >but then: >>> > >static int tun_peek_len(struct socket *sock) >>> > >{ >>> > > >>> > >... >>> > > >>> > > struct tun_struct *tun; >>> > >... >>> > > tun = __tun_get(tfile); >>> > > if (!tun) >>> > > return 0; >>> > > >>> > > >>> > >so peek len should return 0. >>> > > >>> > >then while will exit: >>> > > while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk))) >>> > >... >>> > > >> > >> >Consider this case: user do ip link del link tap0 before recvmsg() but after >> >tun_peek_len() ? > Sure, this can happen, but I think we'll just exit on the next loop, > won't we? > Right, this is the only case I can image for -EBADFD, let's wait for the author to the steps.