Received: from eggs.gnu.org ([2001:4830:134:3::10]:38832) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctui4-0002UC-Ct for qemu-devel@nongnu.org; Fri, 31 Mar 2017 07:27:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctuhz-0006yi-Fg for qemu-devel@nongnu.org; Fri, 31 Mar 2017 07:27:16 -0400 Received: from 4.mo179.mail-out.ovh.net ([46.105.36.149]:51956) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctuhz-0006yF-92 for qemu-devel@nongnu.org; Fri, 31 Mar 2017 07:27:11 -0400 Received: from player755.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 0402E341A6 for ; Fri, 31 Mar 2017 13:27:10 +0200 (CEST) From: Greg Kurz Date: Fri, 31 Mar 2017 13:27:00 +0200 Message-ID: <149095962044.26233.2156597686399438923.stgit@bahia.lan> In-Reply-To: <149095959109.26233.3201018420228514740.stgit@bahia> References: <149095959109.26233.3201018420228514740.stgit@bahia> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [for-2.9 PATCH 1/3] 9pfs: clear migration blocker at session reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eric Blake , Li Qiang , Greg Kurz The migration blocker survives a device reset: if the guest mounts a 9p share and then gets rebooted with system_reset, it will be unmigratable until it remounts and umounts the 9p share again. This happens because the migration blocker is supposed to be cleared when we put the last reference on the root fid, but virtfs_reset() wrongly calls free_fid() instead of put_fid(). This patch fixes virtfs_reset() so that it honor the way fids are supposed to be manipulated: first get a reference and later put it back when you're done. Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 48babce836b6..cc109367b030 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -539,14 +539,15 @@ static void coroutine_fn virtfs_reset(V9fsPDU *pdu) /* Free all fids */ while (s->fid_list) { + /* Get fid */ fidp = s->fid_list; + fidp->ref++; + + /* Clunk fid */ s->fid_list = fidp->next; + fidp->clunked = 1; - if (fidp->ref) { - fidp->clunked = 1; - } else { - free_fid(pdu, fidp); - } + put_fid(pdu, fidp); } }