qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing.


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing.
Date: Thu, 05 Jun 2014 03:55:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

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'll apply the patch.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]