cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qemu-ga-execute-fsfreeze-freeze-in-reverse-order-of-.patch

218e99
From 80fc609da0904d6b8f21ef017808622567ed91b5 Mon Sep 17 00:00:00 2001
218e99
Message-Id: <80fc609da0904d6b8f21ef017808622567ed91b5.1383564115.git.minovotn@redhat.com>
218e99
In-Reply-To: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
218e99
References: <5575e0aec51f40ebec46e98ec085cda053283aba.1383564115.git.minovotn@redhat.com>
218e99
From: Tomoki Sekiyama <tsekiyam@redhat.com>
218e99
Date: Tue, 15 Oct 2013 21:40:57 +0200
218e99
Subject: [PATCH 11/14] qemu-ga: execute fsfreeze-freeze in reverse order of
218e99
 mounts
218e99
218e99
RH-Author: Tomoki Sekiyama <tsekiyam@redhat.com>
218e99
Message-id: <1381873257-2800-1-git-send-email-tsekiyam@redhat.com>
218e99
Patchwork-id: 54955
218e99
O-Subject: [RHEL 7.0 qemu-kvm PATCH] qemu-ga: execute fsfreeze-freeze in reverse order of mounts
218e99
Bugzilla: 1019352
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
218e99
From: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
218e99
218e99
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1019352
218e99
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6420515
218e99
218e99
Currently, fsfreeze-freeze may cause deadlock if a guest has loopback mounts
218e99
of image files in its disk; e.g.:
218e99
218e99
    # mount | grep ^/
218e99
    /dev/vda1 / type ext4 (rw,noatime,seclabel,data=ordered)
218e99
    /tmp/disk.img on /mnt type ext4 (rw,relatime,seclabel)
218e99
218e99
To avoid the deadlock, this freezes filesystems in reverse order of mounts.
218e99
218e99
Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
*fix up commit msg
218e99
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
218e99
(cherry picked from commit e5d9adbdab972a2172815c1174aed3fabcc448f1)
218e99
---
218e99
 qga/commands-posix.c | 4 ++--
218e99
 1 file changed, 2 insertions(+), 2 deletions(-)
218e99
218e99
Signed-off-by: Michal Novotny <minovotn@redhat.com>
218e99
---
218e99
 qga/commands-posix.c | 4 ++--
218e99
 1 file changed, 2 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
218e99
index e199738..f453132 100644
218e99
--- a/qga/commands-posix.c
218e99
+++ b/qga/commands-posix.c
218e99
@@ -566,7 +566,7 @@ typedef struct FsMount {
218e99
     QTAILQ_ENTRY(FsMount) next;
218e99
 } FsMount;
218e99
 
218e99
-typedef QTAILQ_HEAD(, FsMount) FsMountList;
218e99
+typedef QTAILQ_HEAD(FsMountList, FsMount) FsMountList;
218e99
 
218e99
 static void free_fs_mount_list(FsMountList *mounts)
218e99
 {
218e99
@@ -728,7 +728,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
218e99
     /* cannot risk guest agent blocking itself on a write in this state */
218e99
     ga_set_frozen(ga_state);
218e99
 
218e99
-    QTAILQ_FOREACH(mount, &mounts, next) {
218e99
+    QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) {
218e99
         fd = qemu_open(mount->dirname, O_RDONLY);
218e99
         if (fd == -1) {
218e99
             error_setg_errno(err, errno, "failed to open %s", mount->dirname);
218e99
-- 
218e99
1.7.11.7
218e99