Received: from eggs.gnu.org ([140.186.70.92]:37576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61c0-00016w-67 for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:47:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R61bu-0005KG-FA for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:47:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61bu-0005KC-5m for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:47:46 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KElj4O027416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 10:47:45 -0400 From: Juan Quintela In-Reply-To: <20110920142501.GF660@redhat.com> (Daniel P. Berrange's message of "Tue, 20 Sep 2011 15:25:01 +0100") References: <2fb9e253266c4926a168168c854fdf5c68ccfca3.1316524908.git.quintela@redhat.com> <20110920142501.GF660@redhat.com> Date: Tue, 20 Sep 2011 16:47:38 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 2/7] migration: only flush when there are no errors Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org "Daniel P. Berrange" wrote: > On Tue, Sep 20, 2011 at 03:24:41PM +0200, Juan Quintela wrote: >> If we have one error while migrating, and then we issuse a >> "migrate_cancel" command, guest hang. Fix it for flushing only when >> migration is in MIG_STATE_ACTIVE. In case of error of cancellation, >> don't flush. >> >> We had an infinite loop at buffered_close() >> >> while (!s->has_error && s->buffer_size) { >> buffered_flush(s); >> if (s->freeze_output) >> s->wait_for_unfreeze(s); >> } >> >> There was no errors, there were things to send, and connection was >> broken. send() returns -EAGAIN, so we freezed output, but we >> unfreeze_output and try again. > > I posted a couple of alternative approaches to fixing this > hang problem > > http://lists.nongnu.org/archive/html/qemu-devel/2011-08/msg03248.html > > My second approach of checking the migration state in migrate_fd_put_buffer() > seems like it would be worthwhile, even with your patch as an additional > safety net against bad code. We can add that there, but in my tests, the s->write() was returning correctly an error (or -EAGAIN). The problem was that we were not exiting when we didn't needed to. I agree that we can have *both* tests. I will add your patch to my series. Thanks for the fast review. Later, Juan.