Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 2021 00:30:09 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c1abd6bd3d99 - stable/13 - shutdown: unmount filesystems after swapoff
Message-ID:  <202112060030.1B60U9Zg088529@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

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

commit c1abd6bd3d998b30b705d2593eef0b3ac90ce7b8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-28 01:52:46 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
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 */
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112060030.1B60U9Zg088529>