[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-upstream-unstable] qemu-ga: execute fsfreeze-freeze in reverse order of mounts

commit 9388fdb603e69d1c251f9bdfaac575ad3258583a
Author:     Tomoki Sekiyama <tomoki.sekiyama@xxxxxxx>
AuthorDate: Tue Oct 1 17:09:53 2013 -0400
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Dec 9 14:45:41 2013 -0600

    qemu-ga: execute fsfreeze-freeze in reverse order of mounts
    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@xxxxxxx>
    Reviewed-by: Eric Blake <eblake@xxxxxxxxxx>
    *fix up commit msg
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
    (cherry picked from commit e5d9adbdab972a2172815c1174aed3fabcc448f1)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
 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 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 */
-    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);
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git

Xen-changelog mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.