The branch stable/13 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c1abd6bd3d998b30b705d2593eef0b3ac90ce7b8

commit c1abd6bd3d998b30b705d2593eef0b3ac90ce7b8
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-11-28 01:52:46 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-12-06 00:29:43 +0000

    shutdown: unmount filesystems after swapoff
    
    (cherry picked from commit 08bb51f8d60c552d1f7c202cc2eb267ed480e541)
---
 sys/kern/vfs_bio.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index eb3dd9ff6038..511bcb746a00 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1443,16 +1443,21 @@ bufshutdown(int show_busybufs)
                 */
                printf("Giving up on %d buffers\n", nbusy);
                DELAY(5000000); /* 5 seconds */
+               swapoff_all();
        } else {
                if (!first_buf_printf)
                        printf("Final sync complete\n");
+
                /*
-                * Unmount filesystems
+                * Unmount filesystems.  Swapoff before unmount,
+                * because file-backed swap is non-operational after unmount
+                * of the underlying filesystem.
                 */
-               if (!KERNEL_PANICKED())
+               if (!KERNEL_PANICKED()) {
+                       swapoff_all();
                        vfs_unmountall();
+               }
        }
-       swapoff_all();
        DELAY(100000);          /* wait for console output to finish */
 }
 

Reply via email to