From 80fc609da0904d6b8f21ef017808622567ed91b5 Mon Sep 17 00:00:00 2001
Message-Id: <80fc609da0904d6b8f21ef017808622567ed91b5.1383564115.git.minovotn@redhat.com>
In-Reply-To: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
References: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
From: Tomoki Sekiyama <tsekiyam@redhat.com>
Date: Tue, 15 Oct 2013 21:40:57 +0200
Subject: [PATCH 11/14] qemu-ga: execute fsfreeze-freeze in reverse order of
mounts
RH-Author: Tomoki Sekiyama <tsekiyam@redhat.com>
Message-id: <1381873257-2800-1-git-send-email-tsekiyam@redhat.com>
Patchwork-id: 54955
O-Subject: [RHEL 7.0 qemu-kvm PATCH] qemu-ga: execute fsfreeze-freeze in reverse order of mounts
Bugzilla: 1019352
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
From: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1019352
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6420515
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 <tomoki.sekiyama@hds.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
*fix up commit msg
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit e5d9adbdab972a2172815c1174aed3fabcc448f1)
---
qga/commands-posix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
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.11.7