git: a5c2d59ed3d6 - main - Expand comment explaining reasons for automatic swapoff on shutdown

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 03 Dec 2021 08:50:18 UTC
The branch main has been updated by kib:

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

commit a5c2d59ed3d6365c26322f3e100467454774b501
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-29 19:11:33 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-12-03 08:42:21 +0000

    Expand comment explaining reasons for automatic swapoff on shutdown
    
    Reviewed by:    alc, markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D33167
---
 sys/kern/vfs_bio.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 61fe9a6e2bfd..acd16ecdf3fe 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1458,9 +1458,16 @@ bufshutdown(int show_busybufs)
 			printf("Final sync complete\n");
 
 		/*
-		 * Unmount filesystems.  Swapoff before unmount,
-		 * because file-backed swap is non-operational after unmount
-		 * of the underlying filesystem.
+		 * Unmount filesystems and perform swapoff, to quiesce
+		 * the system as much as possible.  In particular, no
+		 * I/O should be initiated from top levels since it
+		 * might be abruptly terminated by reset, or otherwise
+		 * erronously handled because other parts of the
+		 * system are disabled.
+		 *
+		 * Swapoff before unmount, because file-backed swap is
+		 * non-operational after unmount of the underlying
+		 * filesystem.
 		 */
 		if (!KERNEL_PANICKED()) {
 			swapoff_all();