Received: from eggs.gnu.org ([140.186.70.92]:49015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qj3MR-0004JT-M2 for qemu-devel@nongnu.org; Tue, 19 Jul 2011 02:00:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qj3MP-0006cA-1B for qemu-devel@nongnu.org; Tue, 19 Jul 2011 02:00:51 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:59334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qj3MO-0006ao-Jf for qemu-devel@nongnu.org; Tue, 19 Jul 2011 02:00:48 -0400 Message-ID: <4E251D82.6050303@msgid.tls.msk.ru> Date: Tue, 19 Jul 2011 10:00:34 +0400 From: Michael Tokarev MIME-Version: 1.0 References: <4E183654.5010501@msgid.tls.msk.ru> In-Reply-To: <4E183654.5010501@msgid.tls.msk.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] failed migration makes monitor stuck List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Ping? Anyone know this area of code? Can we just remove one monitor_resume() call from migrate_fd_put_buffer() ? 09.07.2011 15:07, Michael Tokarev wrote: > After some debugging I found a programming error in > error handling in migration, but I'm not sure how to > fix it. > > When migration starts, monitor gets suspended, calling > monitor_suspend() routine which increments assotiated > suspend_cnt counter. > > At the end of migration, in migrate_fd_cleanup(), > monitor_resume() gets called, which decrements the > counter. > > But monitor_resume() gets also called from another > place, in migrate_fd_put_buffer(), in case we > encountered a write error. > > So, suppose a tcp endpoint has disconnected, or the > exec: program terminated due to error or whatnot -- > in all these cases write will fail, and we'll call > monitor_resume() twice as a result: once in this > place in migrate_fd_put_buffer(), and once more at > the end in migrate_fd_cleanup(). > > This results in suspend_cnt being decremented twice, > with the resultant value being -1. > > So monitor_can_read() will return 0 from now on, since > it compares suspend_cnt with 0. And hence, monitor will > stop working. > > To me it looks like monitor_resume() call should be > removed from migrate_fd_put_buffer(), but I'm not sure > _why_ it were here in the first place. > > There's more: monitor_suspend() gets called from within > protocol handlers (using migrate_fd_monitor_suspend() > routine), -- are we sure that all current and future > protocol handlers will call this function? > > Thanks! > > /mjt >