From nobody Mon Feb 9 05:40:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493272189515154.75567988217563; Wed, 26 Apr 2017 22:49:49 -0700 (PDT) Received: from localhost ([::1]:58854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3cJI-0002pD-6n for importer@patchew.org; Thu, 27 Apr 2017 01:49:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3cH7-0001EJ-TN for qemu-devel@nongnu.org; Thu, 27 Apr 2017 01:47:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3cH4-0003lO-K2 for qemu-devel@nongnu.org; Thu, 27 Apr 2017 01:47:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34689 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d3cH4-0003lE-DI for qemu-devel@nongnu.org; Thu, 27 Apr 2017 01:47:30 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3R5ha0Y066115 for ; Thu, 27 Apr 2017 01:47:29 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a34vqu17t-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 27 Apr 2017 01:47:29 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Apr 2017 23:47:28 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Apr 2017 23:47:26 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3R5lP6a16712106; Wed, 26 Apr 2017 22:47:25 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B8B76E03A; Wed, 26 Apr 2017 23:47:25 -0600 (MDT) Received: from localhost (unknown [9.80.102.60]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 644FA6E035; Wed, 26 Apr 2017 23:47:25 -0600 (MDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Thu, 27 Apr 2017 00:46:31 -0500 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493271996-23607-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1493271996-23607-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17042705-0020-0000-0000-00000BD4A52A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006981; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00853062; UDB=6.00421735; IPR=6.00631898; BA=6.00005313; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015201; XFM=3.00000013; UTC=2017-04-27 05:47:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042705-0021-0000-0000-00005BFF2829 Message-Id: <1493271996-23607-4-git-send-email-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-27_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=4 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704270094 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL v2 3/8] qga-win: Fix a bug where qemu-ga service is stuck during stop operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Sameeh Jubran Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sameeh Jubran After triggering a freeze command without any following thaw command, qemu-ga will not respond to stop operation. This behaviour is wanted on Lin= ux as there is no time limit for a freeze command and we want to prevent quitting in the middle of freeze, on the other hand on Windows the time limit for freeze is 10 seconds, so we should wait for the timeout, thaw the file system and quit. Signed-off-by: Sameeh Jubran Signed-off-by: Michael Roth --- qga/main.c | 23 +++++++++++++++++++++++ qga/vss-win32.h | 1 + qga/vss-win32/vss-common.h | 11 +---------- qga/vss-win32/vss-handles.h | 14 ++++++++++++++ 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 qga/vss-win32/vss-handles.h diff --git a/qga/main.c b/qga/main.c index 07c2953..ad6f68f 100644 --- a/qga/main.c +++ b/qga/main.c @@ -131,9 +131,32 @@ static void quit_handler(int sig) * unless all log/pid files are on unfreezable filesystems. there's * also a very likely chance killing the agent before unfreezing * the filesystems is a mistake (or will be viewed as one later). + * On Windows the freeze interval is limited to 10 seconds, so + * we should quit, but first we should wait for the timeout, thaw + * the filesystem and quit. */ if (ga_is_frozen(ga_state)) { +#ifdef _WIN32 + int i =3D 0; + Error *err =3D NULL; + HANDLE hEventTimeout; + + g_debug("Thawing filesystems before exiting"); + + hEventTimeout =3D OpenEvent(EVENT_ALL_ACCESS, FALSE, EVENT_NAME_TI= MEOUT); + if (hEventTimeout) { + WaitForSingleObject(hEventTimeout, 0); + CloseHandle(hEventTimeout); + } + qga_vss_fsfreeze(&i, false, &err); + if (err) { + g_debug("Error unfreezing filesystems prior to exiting: %s", + error_get_pretty(err)); + error_free(err); + } +#else return; +#endif } g_debug("received signal num %d, quitting", sig); =20 diff --git a/qga/vss-win32.h b/qga/vss-win32.h index 51d303a..4f8e39a 100644 --- a/qga/vss-win32.h +++ b/qga/vss-win32.h @@ -13,6 +13,7 @@ #ifndef VSS_WIN32_H #define VSS_WIN32_H =20 +#include "qga/vss-win32/vss-handles.h" =20 bool vss_init(bool init_requester); void vss_deinit(bool deinit_requester); diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h index c81a856..61c170b 100644 --- a/qga/vss-win32/vss-common.h +++ b/qga/vss-win32/vss-common.h @@ -51,21 +51,12 @@ * http://www.microsoft.com/en-us/download/details.aspx?id=3D23490 */ #include +#include "vss-handles.h" =20 /* Macros to convert char definitions to wchar */ #define _L(a) L##a #define L(a) _L(a) =20 -/* Constants for QGA VSS Provider */ - -#define QGA_PROVIDER_NAME "QEMU Guest Agent VSS Provider" -#define QGA_PROVIDER_LNAME L(QGA_PROVIDER_NAME) -#define QGA_PROVIDER_VERSION L(QEMU_VERSION) - -#define EVENT_NAME_FROZEN "Global\\QGAVSSEvent-frozen" -#define EVENT_NAME_THAW "Global\\QGAVSSEvent-thaw" -#define EVENT_NAME_TIMEOUT "Global\\QGAVSSEvent-timeout" - const GUID g_gProviderId =3D { 0x3629d4ed, 0xee09, 0x4e0e, {0x9a, 0x5c, 0x6d, 0x8b, 0xa2, 0x87, 0x2a, 0xef} }; const GUID g_gProviderVersion =3D { 0x11ef8b15, 0xcac6, 0x40d6, diff --git a/qga/vss-win32/vss-handles.h b/qga/vss-win32/vss-handles.h new file mode 100644 index 0000000..ff399dd --- /dev/null +++ b/qga/vss-win32/vss-handles.h @@ -0,0 +1,14 @@ +#ifndef VSS_HANDLES +#define VSS_HANDLES + +/* Constants for QGA VSS Provider */ + +#define QGA_PROVIDER_NAME "QEMU Guest Agent VSS Provider" +#define QGA_PROVIDER_LNAME L(QGA_PROVIDER_NAME) +#define QGA_PROVIDER_VERSION L(QEMU_VERSION) + +#define EVENT_NAME_FROZEN "Global\\QGAVSSEvent-frozen" +#define EVENT_NAME_THAW "Global\\QGAVSSEvent-thaw" +#define EVENT_NAME_TIMEOUT "Global\\QGAVSSEvent-timeout" + +#endif --=20 2.7.4