[Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout

Chen Hanxiao posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1506048366-23368-1-git-send-email-chen_han_xiao@126.com
Test checkpatch passed
Test docker passed
Test s390x passed
qga/vss-win32/requester.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
[Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout
Posted by Chen Hanxiao 6 years, 7 months ago
From: Chen Hanxiao <chenhanxiao@gmail.com>

When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
is executed, VSS may timeout when trying to hold writes.

Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
is logged in the Event Viewer.

At that time, if we call AbortBackup, qga may hang forever.

This patch will solve this issues.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
---
 qga/vss-win32/requester.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 301762d..3d9c971 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet *errset)
             break;
         }
     }
+
+    if (wait_status == WAIT_TIMEOUT) {
+        err_set(errset, E_FAIL,
+                "timeout when try to receive Frozen event from VSS provider");
+        /* If we are here, VSS had timeout.
+         * Don't call AbortBackup, just return directly.
+         */
+        goto out1;
+    }
+
     if (wait_status != WAIT_OBJECT_0) {
         err_set(errset, E_FAIL,
                 "couldn't receive Frozen event from VSS provider");
@@ -432,6 +442,8 @@ out:
     if (vss_ctx.pVssbc) {
         vss_ctx.pVssbc->AbortBackup();
     }
+
+out1:
     requester_cleanup();
     CoUninitialize();
 }
-- 
2.7.5


Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout
Posted by Tomoki Sekiyama 6 years, 7 months ago
Thanks for your patch.
Which version of Windows have you found the hang?

Regards,
Tomoki

2017-09-22 11:46 GMT+09:00 Chen Hanxiao <chen_han_xiao@126.com>:

> From: Chen Hanxiao <chenhanxiao@gmail.com>
>
> When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> is executed, VSS may timeout when trying to hold writes.
>
> Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> is logged in the Event Viewer.
>
> At that time, if we call AbortBackup, qga may hang forever.
>
> This patch will solve this issues.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
> ---
>  qga/vss-win32/requester.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 301762d..3d9c971 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet *errset)
>              break;
>          }
>      }
> +
> +    if (wait_status == WAIT_TIMEOUT) {
> +        err_set(errset, E_FAIL,
> +                "timeout when try to receive Frozen event from VSS
> provider");
> +        /* If we are here, VSS had timeout.
> +         * Don't call AbortBackup, just return directly.
> +         */
> +        goto out1;
> +    }
> +
>      if (wait_status != WAIT_OBJECT_0) {
>          err_set(errset, E_FAIL,
>                  "couldn't receive Frozen event from VSS provider");
> @@ -432,6 +442,8 @@ out:
>      if (vss_ctx.pVssbc) {
>          vss_ctx.pVssbc->AbortBackup();
>      }
> +
> +out1:
>      requester_cleanup();
>      CoUninitialize();
>  }
> --
> 2.7.5
>
>
Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout
Posted by Chen Hanxiao 6 years, 7 months ago
在 2017-09-23 05:12:20,"Tomoki Sekiyama" <tomoki.sekiyama@gmail.com> 写道:
 
> 
> Thanks for your patch.
> Which version of Windows have you found the hang?
> 
> 
  I tested on win08, win 08 r2 and win2012.

QGA versions:

  Use the latest qga-win from 
  https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-qemu-ga/qemu-ga-win-7.4.5-1/
 
  and stable branch from
  https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.126-2/virtio-win-0.1.126.iso

  All of them have the same behavior.

How to reproduce:

  Copy a big file in guest (from d: to c:), then do fsfreeze when IO is in progress.

  At this time, we had a very chance to see that qga hang for a long time.

  Libvirt will not recieve a reply.
  qemu-ga service even don't answer `net stop` command.


Regards,
- Chen
 
  

> Regards,
> Tomoki
> 
> 
> 2017-09-22 11:46 GMT+09:00 Chen Hanxiao <chen_han_xiao@126.com>:
> 
> From: Chen Hanxiao <chenhanxiao@gmail.com>
> 
> 
> 
> When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> 
> is executed, VSS may timeout when trying to hold writes.
> 
> 
> 
> Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> 
> is logged in the Event Viewer.
> 
> 
> 
> At that time, if we call AbortBackup, qga may hang forever.
> 
> 
> 
> This patch will solve this issues.
> 
> 
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
> 
> ---
> 
>  qga/vss-win32/requester.cpp | 12 ++++++++++++
> 
>  1 file changed, 12 insertions(+)
> 
> 
> 
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> 
> index 301762d..3d9c971 100644
> 
> --- a/qga/vss-win32/requester.cpp
> 
> +++ b/qga/vss-win32/requester.cpp
> 
> @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet *errset)
> 
>              break;
> 
>          }
> 
>      }
> 
> +
> 
> +    if (wait_status == WAIT_TIMEOUT) {
> 
> +        err_set(errset, E_FAIL,
> 
> +                "timeout when try to receive Frozen event from VSS provider");
> 
> +        /* If we are here, VSS had timeout.
> 
> +         * Don't call AbortBackup, just return directly.
> 
> +         */
> 
> +        goto out1;
> 
> +    }
> 
> +
> 
>      if (wait_status != WAIT_OBJECT_0) {
> 
>          err_set(errset, E_FAIL,
> 
>                  "couldn't receive Frozen event from VSS provider");
> 
> @@ -432,6 +442,8 @@ out:
> 
>      if (vss_ctx.pVssbc) {
> 
>          vss_ctx.pVssbc->AbortBackup();
> 
>      }
> 
> +
> 
> +out1:
> 
>      requester_cleanup();
> 
>      CoUninitialize();
> 
>  }



















Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout
Posted by Tomoki Sekiyama 6 years, 7 months ago
2017-09-23 12:11 GMT+09:00 Chen Hanxiao <chen_han_xiao@126.com>:

>
> 在 2017-09-23 05:12:20,"Tomoki Sekiyama" <tomoki.sekiyama@gmail.com> 写道:
>
> >
> > Thanks for your patch.
> > Which version of Windows have you found the hang?
> >
> >
>   I tested on win08, win 08 r2 and win2012.
>

Thank you for the info.

The patch looks good to me.

Regards,
Tomoki


> QGA versions:
>
>   Use the latest qga-win from
>   https://fedorapeople.org/groups/virt/virtio-win/direct-
> downloads/archive-qemu-ga/qemu-ga-win-7.4.5-1/
>
>   and stable branch from
>   https://fedorapeople.org/groups/virt/virtio-win/direct-
> downloads/archive-virtio/virtio-win-0.1.126-2/virtio-win-0.1.126.iso
>
>   All of them have the same behavior.
>
> How to reproduce:
>
>   Copy a big file in guest (from d: to c:), then do fsfreeze when IO is in
> progress.
>
>   At this time, we had a very chance to see that qga hang for a long time.
>
>   Libvirt will not recieve a reply.
>   qemu-ga service even don't answer `net stop` command.
>
>
> Regards,
> - Chen
>
>
>
> > Regards,
> > Tomoki
> >
> >
> > 2017-09-22 11:46 GMT+09:00 Chen Hanxiao <chen_han_xiao@126.com>:
> >
> > From: Chen Hanxiao <chenhanxiao@gmail.com>
> >
> >
> >
> > When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> >
> > is executed, VSS may timeout when trying to hold writes.
> >
> >
> >
> > Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> >
> > is logged in the Event Viewer.
> >
> >
> >
> > At that time, if we call AbortBackup, qga may hang forever.
> >
> >
> >
> > This patch will solve this issues.
> >
> >
> >
> > Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
> >
> > ---
> >
> >  qga/vss-win32/requester.cpp | 12 ++++++++++++
> >
> >  1 file changed, 12 insertions(+)
> >
> >
> >
> > diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> >
> > index 301762d..3d9c971 100644
> >
> > --- a/qga/vss-win32/requester.cpp
> >
> > +++ b/qga/vss-win32/requester.cpp
> >
> > @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet
> *errset)
> >
> >              break;
> >
> >          }
> >
> >      }
> >
> > +
> >
> > +    if (wait_status == WAIT_TIMEOUT) {
> >
> > +        err_set(errset, E_FAIL,
> >
> > +                "timeout when try to receive Frozen event from VSS
> provider");
> >
> > +        /* If we are here, VSS had timeout.
> >
> > +         * Don't call AbortBackup, just return directly.
> >
> > +         */
> >
> > +        goto out1;
> >
> > +    }
> >
> > +
> >
> >      if (wait_status != WAIT_OBJECT_0) {
> >
> >          err_set(errset, E_FAIL,
> >
> >                  "couldn't receive Frozen event from VSS provider");
> >
> > @@ -432,6 +442,8 @@ out:
> >
> >      if (vss_ctx.pVssbc) {
> >
> >          vss_ctx.pVssbc->AbortBackup();
> >
> >      }
> >
> > +
> >
> > +out1:
> >
> >      requester_cleanup();
> >
> >      CoUninitialize();
> >
> >  }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout
Posted by Chen Hanxiao 6 years, 6 months ago
At 2017-09-22 10:46:06, "Chen Hanxiao" <chen_han_xiao@126.com> wrote:
>From: Chen Hanxiao <chenhanxiao@gmail.com>
>
>When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
>is executed, VSS may timeout when trying to hold writes.
>
>Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
>is logged in the Event Viewer.
>
>At that time, if we call AbortBackup, qga may hang forever.
>
>This patch will solve this issues.
>
>Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>

Hi, Michael

 Any comments?

http://lists.nongnu.org/archive/html/qemu-devel/2017-09/msg06199.html

Regards,
- Chen