From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUMYa-0001sQ-RO for qemu-devel@nongnu.org; Thu, 10 Oct 2013 16:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUMYV-0002Ja-Em for qemu-devel@nongnu.org; Thu, 10 Oct 2013 16:10:00 -0400 Received: from mail-qa0-x235.google.com ([2607:f8b0:400d:c00::235]:38404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUMYV-0002JV-A6 for qemu-devel@nongnu.org; Thu, 10 Oct 2013 16:09:55 -0400 Received: by mail-qa0-f53.google.com with SMTP id k4so31066qaq.12 for ; Thu, 10 Oct 2013 13:09:55 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Thu, 10 Oct 2013 15:09:40 -0500 Message-Id: <1381435782-25524-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1381435782-25524-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1381435782-25524-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/3] qemu-ga: execute fsfreeze-freeze in reverse order of mounts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: wudxw@linux.vnet.ibm.com, tomoki.sekiyama@hds.com, aliguori@amazon.com From: Tomoki Sekiyama Currently, fsfreeze-freeze may cause deadlock if a guest has loopback mounts of image files in its disk; e.g.: # mount | grep ^/ /dev/vda1 / type ext4 (rw,noatime,seclabel,data=ordered) /tmp/disk.img on /mnt type ext4 (rw,relatime,seclabel) To avoid the deadlock, this freezes filesystems in reverse order of mounts. Signed-off-by: Tomoki Sekiyama Reviewed-by: Eric Blake *fix up commit msg Signed-off-by: Michael Roth --- 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 = qemu_open(mount->dirname, O_RDONLY); if (fd == -1) { error_setg_errno(err, errno, "failed to open %s", mount->dirname); -- 1.7.9.5