[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing.
From: |
Hani Benhabiles |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing. |
Date: |
Thu, 5 Jun 2014 10:58:45 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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 ?