Module Name:    src
Committed By:   jdolecek
Date:           Wed May 13 22:13:49 UTC 2020

Modified Files:
        src/sys/arch/xen/xen: shutdown_xenbus.c

Log Message:
fix how shutdown is acknowledged - do it just by writing empty value
into the key; this is necessary for suspend, for it removal fails with
EACCESS

now 'xl save' proceeds almost instantly without timing out, and no longer
complains about the domain not acknowleding suspend

part of port-xen/55207


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/xen/shutdown_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/shutdown_xenbus.c
diff -u src/sys/arch/xen/xen/shutdown_xenbus.c:1.8 src/sys/arch/xen/xen/shutdown_xenbus.c:1.9
--- src/sys/arch/xen/xen/shutdown_xenbus.c:1.8	Tue Apr  7 11:47:06 2020
+++ src/sys/arch/xen/xen/shutdown_xenbus.c	Wed May 13 22:13:49 2020
@@ -1,4 +1,4 @@
-/*	$Id: shutdown_xenbus.c,v 1.8 2020/04/07 11:47:06 jdolecek Exp $	*/
+/*	$Id: shutdown_xenbus.c,v 1.9 2020/05/13 22:13:49 jdolecek Exp $	*/
 
 /*-
  * Copyright (c)2006 YAMAMOTO Takashi,
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: shutdown_xenbus.c,v 1.8 2020/04/07 11:47:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shutdown_xenbus.c,v 1.9 2020/05/13 22:13:49 jdolecek Exp $");
 
 #include <sys/param.h>
 
@@ -97,8 +97,9 @@ again:
 	}
 	error = xenbus_read(xbt, SHUTDOWN_PATH, SHUTDOWN_NAME,
 	    reqstr, sizeof(reqstr));
-	if (error) {
-		if (error != ENOENT) {
+	/* Ignore if read error or empty value */
+	if (error || reqstr[0] == '\0') {
+		if (error && error != ENOENT) {
 			printf("%s: xenbus_read %d\n", __func__, error);
 		}
 		error = xenbus_transaction_end(xbt, 1);
@@ -109,7 +110,8 @@ again:
 		return;
 	}
 
-	error = xenbus_rm(xbt, SHUTDOWN_PATH, SHUTDOWN_NAME);
+	/* Acknowledge the command */
+	error = xenbus_write(xbt, SHUTDOWN_PATH, SHUTDOWN_NAME, "");
 	if (error) {
 		printf("%s: xenbus_rm %d\n", __func__, error);
 	}

Reply via email to