[Bug 276784] Do not power off with shutdown -p

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 02 Feb 2024 14:43:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276784

            Bug ID: 276784
           Summary: Do not power off with shutdown -p
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: katsubsd@gmail.com

=============================================================================
commit 9cdf326b4faef97f0d3314b5dd693308ac494d48
Author:     Andriy Gapon <avg@FreeBSD.org>
AuthorDate: Mon Dec 20 13:01:56 2021 +0200
Commit:     Andriy Gapon <avg@FreeBSD.org>
CommitDate: Sun Jan 28 15:04:55 2024 +0200

    run acpi_shutdown_final later to give other handlers a chance

    For example, shutdown_panic wants to produce some output and maybe take
    some input before a system is actually reset.

    The change should only make difference for the case of system reset
    (reboot), poweroff and halt should not be affected.

    The change makes difference only if hw.acpi.handle_reboot is set.  It
    used to default to zero until r213755 / ac731af5670c7.

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 9196c446ae80..7d1fc10afb9e 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -675,7 +675,7 @@ acpi_attach(device_t dev)

     /* Register our shutdown handler. */
     EVENTHANDLER_REGISTER(shutdown_final, acpi_shutdown_final, sc,
-       SHUTDOWN_PRI_LAST);
+       SHUTDOWN_PRI_LAST + 150);

     /*
      * Register our acpi event handlers.
=============================================================================

Since this commit I can no longer power off with shutdown -p.

=============================================================================
# shutdown -p now
...
Waiting (max 60 seconds) for system process `vnlru' to stop... done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining... 0 0 0 0 0 done
All buffers synced.
Uptime: 1m42s
uhub4: detached
uhub0: detached
uhub4: detached
...
...
uhub2: detached

The operating system has halted.
Please press any key to reboot.
[The system stalled with power on.]
=============================================================================

I reverted the changes in the above commit. And I can now power off with
shutdown -p.

-- 
You are receiving this mail because:
You are the assignee for the bug.