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