From dc7297f2d96febb58be9fa55a0db2832974d9d44 Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Tue, 15 Oct 2013 14:59:49 +0200 Subject: [PATCH 4/4] qemu-ga: execute fsfreeze-freeze in reverse order of mounts RH-Author: Tomoki Sekiyama Message-id: <1381849189-28183-1-git-send-email-tsekiyam@redhat.com> Patchwork-id: 54945 O-Subject: [RHEL 6.5 qemu-kvm PATCH v2] qemu-ga: execute fsfreeze-freeze in reverse order of mounts Bugzilla: 1015633 RH-Acked-by: Paolo Bonzini RH-Acked-by: Laszlo Ersek RH-Acked-by: Luiz Capitulino From: Tomoki Sekiyama Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1015633 Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6406845 Upstream-status: merged; e5d9adbdab972a2172815c1174aed3fabcc448f1 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 --- v1->v2: updated commit log and upstream status as it is merged --- qga/commands-posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Miroslav Rezanina --- qga/commands-posix.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 87f596d..234f794 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -567,7 +567,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) { @@ -729,7 +729,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.1