From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ap23c-0003T1-SA for qemu-devel@nongnu.org; Sat, 09 Apr 2016 19:12:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ap23b-0005L9-RZ for qemu-devel@nongnu.org; Sat, 09 Apr 2016 19:12:48 -0400 References: <1460153158-21612-1-git-send-email-eblake@redhat.com> <1460153158-21612-17-git-send-email-eblake@redhat.com> <34A2F10D-3B5B-42CF-9AE0-7A34FF5F78C0@alex.org.uk> From: Eric Blake Message-ID: <57098C6A.6080405@redhat.com> Date: Sat, 9 Apr 2016 17:12:42 -0600 MIME-Version: 1.0 In-Reply-To: <34A2F10D-3B5B-42CF-9AE0-7A34FF5F78C0@alex.org.uk> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8fwtrptxOOU0X6IRPkgVv8BlHOWCJkCt8" Subject: Re: [Qemu-devel] [PATCH 16/18] nbd: Support NBD_CMD_CLOSE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: "qemu-devel@nongnu.org" , Kevin Wolf , Paolo Bonzini , "open list:Block layer core" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8fwtrptxOOU0X6IRPkgVv8BlHOWCJkCt8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/09/2016 04:50 AM, Alex Bligh wrote: >=20 > On 8 Apr 2016, at 23:05, Eric Blake wrote: >=20 >> NBD_CMD_DISC is annoying: the server is not required to reply, >> so the client has no choice but to disconnect once it has sent >> the message; but depending on timing, the server can see the >> disconnect prior to reading the request, and treat things as >> an abrupt exit rather than a clean shutdown (which may affect >> whether the server properly fsync()s data to disk, and so on). >> The new NBD_CMD_CLOSE adds another round of handshake, where >> the client waits for the server's action before closing, to >> make sure both parties know that it was a clean close rather >> than an accidental early disconnect. >> >> In nbd-client.c, nbd_client_close() is called after we have >> already exited the normal coroutine context used by all the >> other transmission phase handlers, so the code is a bit more >> complex to build up a coroutine just for the purpose of waiting >> for the server's response. >> >> Signed-off-by: Eric Blake >=20 > Wouter is not yet convinced of the merits of NBD_CMD_CLOSE > so we should probably resist applying this unless / until we > have convinced him of its benefits. >=20 > BTW there is nothing to stop you doing an fsync() on ANY > disconnect server side. Qemu clients _already_ do the safe actions of waiting for all inflight requests to complete, then sending one final NBD_CMD_FLUSH, before attempting to send NBD_CMD_DISC. If I knew how to make qemu guarantee that the NBD_CMD_DISC hits the wire (even in TLS mode) rather than being dropped early, that seems nicer than having to implement this (although I did learn a bit about qemu coroutines in implementing this). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --8fwtrptxOOU0X6IRPkgVv8BlHOWCJkCt8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXCYxqAAoJEKeha0olJ0NqV8AIAJfM2/cxgC23Gv8/xBt1xPRY gzV6hNUbiqbC8xZnGVFwBQYn8Q/UBGLWFVGShk0FGxkJYZJzvAL0naBNC26daTvx TLjREgMM3QIrJJPfMHyqp09FkXkDij74Q9q0RIO5j0Qqy0SIzVB7WjOrnvQbTnvP 4miT22fMg3heu6M+i4XHAUdXv8H2D9ow72NxHSZ5MxlYImsu8d56jVePe9IpLwwO TJmNShUuacIZagh2itIqZPi25jCmObB/QtE958Zh5ZX/mhkrynU5FR/x3dYU5wd8 MKEK6T4H/zVkHq0yYxRTDn9Xj+saekjpC3N9oI/x9WAE89vaNOcSsYUC9S419eM= =Da1q -----END PGP SIGNATURE----- --8fwtrptxOOU0X6IRPkgVv8BlHOWCJkCt8--