From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsUxs-0002IY-RV for qemu-devel@nongnu.org; Thu, 05 Jun 2014 06:32:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsUxl-0005sM-DO for qemu-devel@nongnu.org; Thu, 05 Jun 2014 06:32:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsUxl-0005s7-6F for qemu-devel@nongnu.org; Thu, 05 Jun 2014 06:32:01 -0400 Message-ID: <5390471A.7040200@redhat.com> Date: Thu, 05 Jun 2014 12:31:54 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1401572382-11667-1-git-send-email-kroosec@gmail.com> <1401572382-11667-4-git-send-email-kroosec@gmail.com> <538DB295.2020508@redhat.com> <20140604222806.GA7620@Inspiron-3521> <538FCE1C.5000708@redhat.com> <20140605095845.GA10811@Inspiron-3521> In-Reply-To: <20140605095845.GA10811@Inspiron-3521> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hani Benhabiles Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com Il 05/06/2014 11:58, Hani Benhabiles ha scritto: > On Thu, Jun 05, 2014 at 03:55:40AM +0200, Paolo Bonzini wrote: >> Il 05/06/2014 00:33, Hani Benhabiles ha scritto: >>>> IIUC, what this does is ensure that the other side gets a FIN before it gets >>>> a RST. Is this correct? >>> >>> Yes. Without shutdown(), this could be reproduced (unreliably) on multiple >>> tries. This is done in nbd_client_close() too, for the same reasons AFAICT. >> >> Actually, nbd_client_close() is different because it's an abortive close of >> the socket. nbd_client_close() doesn't care about FIN vs. RST, it does the >> shutdown to force all the requests to fail (with either an error for writes, >> or a short read if they're receiving). This will cause a flurry of >> nbd_client_put() calls soon after nbd_clint_close() returns, until the last >> reference is dropped and the socket is closed. >> > > I see, thanks for the explanation. > >> I'll apply the patch. > > Will you apply it directly or should I resend it in v3 ? > This is independent, so I can apply it first. Paolo