Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen fix how shutdown is acknowledged - do it ju...



details:   https://anonhg.NetBSD.org/src/rev/0cf25044ab5e
branches:  trunk
changeset: 932694:0cf25044ab5e
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed May 13 22:13:49 2020 +0000

description:
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

diffstat:

 sys/arch/xen/xen/shutdown_xenbus.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r d004a27eaad8 -r 0cf25044ab5e sys/arch/xen/xen/shutdown_xenbus.c
--- a/sys/arch/xen/xen/shutdown_xenbus.c        Wed May 13 21:59:45 2020 +0000
+++ b/sys/arch/xen/xen/shutdown_xenbus.c        Wed May 13 22:13:49 2020 +0000
@@ -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 @@
        }
        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 @@
                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);
        }



Home | Main Index | Thread Index | Old Index