From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTeDb-0001rX-DH for qemu-devel@nongnu.org; Tue, 08 Oct 2013 16:49:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTeDT-00055e-JT for qemu-devel@nongnu.org; Tue, 08 Oct 2013 16:49:23 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:56634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTeDT-00055W-EL for qemu-devel@nongnu.org; Tue, 08 Oct 2013 16:49:15 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Oct 2013 16:49:13 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 5C24F6E8057 for ; Tue, 8 Oct 2013 16:49:10 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22036.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r98KnBc966191534 for ; Tue, 8 Oct 2013 20:49:11 GMT Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r98Kn9uD024551 for ; Tue, 8 Oct 2013 17:49:10 -0300 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <20131001210953.23207.28945.stgit@localhost.localdomain> References: <20131001210953.23207.28945.stgit@localhost.localdomain> Message-ID: <20131008204907.28259.10823@loki> Date: Tue, 08 Oct 2013 15:49:07 -0500 Subject: Re: [Qemu-devel] [PATCH] qemu-ga: execute fsfreeze-freeze in reverse order of mounts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tomoki Sekiyama , qemu-devel@nongnu.org Cc: seiji.aguchi@hds.com, lcapitulino@redhat.com Quoting Tomoki Sekiyama (2013-10-01 16:09:53) > Currently, fsfreeze-freeze may cause deadlock if a guest has loopback mou= nts > of image files in its disk; e.g.: > = > # mount | grep ^/ > /dev/vda1 / type ext4 (rw,noatime,seclabel,data=3Dordered) > /tmp/disk.img on /mnt type ext4 (rw,relatime,seclabel) > = > To avoid the deadlock, this freeze filesystems in reverse order of mounts. > = > Signed-off-by: Tomoki Sekiyama Thanks, applied to qga tree: https://github.com/mdroth/qemu/commits/qga > --- > qga/commands-posix.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > = > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index e199738..f453132 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -566,7 +566,7 @@ typedef struct FsMount { > QTAILQ_ENTRY(FsMount) next; > } FsMount; > = > -typedef QTAILQ_HEAD(, FsMount) FsMountList; > +typedef QTAILQ_HEAD(FsMountList, FsMount) FsMountList; > = > static void free_fs_mount_list(FsMountList *mounts) > { > @@ -728,7 +728,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) > /* cannot risk guest agent blocking itself on a write in this state = */ > ga_set_frozen(ga_state); > = > - QTAILQ_FOREACH(mount, &mounts, next) { > + QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) { > fd =3D qemu_open(mount->dirname, O_RDONLY); > if (fd =3D=3D -1) { > error_setg_errno(err, errno, "failed to open %s", mount->dir= name);