From nobody Mon Nov 29 16:39:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1A1D418B1BC1; Mon, 29 Nov 2021 16:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J2rfG4TR2z3jXH; Mon, 29 Nov 2021 16:39:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7ACB425DB5; Mon, 29 Nov 2021 16:39:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ATGdI10033951; Mon, 29 Nov 2021 16:39:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ATGdIlx033950; Mon, 29 Nov 2021 16:39:18 GMT (envelope-from git) Date: Mon, 29 Nov 2021 16:39:18 GMT Message-Id: <202111291639.1ATGdIlx033950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 08bb51f8d60c - main - shutdown: unmount filesystems after swapoff List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 08bb51f8d60c552d1f7c202cc2eb267ed480e541 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638203958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4TmhjRTNO0hARezHTq4U6t5r3OAhZoR9tS9dgm3rVJM=; b=Ja0V02wzGslH/kCocpqC8aOIOnKNShWOhSqcxcEPc2vt2+7JFJ+AP1uK+/hQ4jokCowaD6 rHnEeXxUOrOIoorE4yMVAPfMg5IbA5cI7t/OLqMW0IsRNy/BMRZ0kH2wskgcgN8o1E4IBF 8MNxDbRCNTzUF40hexGMNlHdYYpQtY6SaLFKX9tbCQz6O5IQ7qgaQPFNQ2FEoiqD2EOTZM aZZ7VmPh3OwlK+urYGKw/ikE7lFQFd3KUkYJPL+YIHsrQayUtAe3fmnwRdAI3B53XK+LfS UeXO28Hpa4jcIn7Iyeb5li1qCKKeIBr++dA/sag6qB9zmsvD6GaIr6yC0HfGlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638203958; a=rsa-sha256; cv=none; b=Ak726kS0DYhYen7kiHZCE4mOtWOWMsVQDqHbq+krU/ovRD4J9NyKmyPIQpXE8kqwDgcPmv Lyt0b7QOHowgyRZsaLCXfO/poJaWFXxYG9zJjuulzOrig8FNd0fJxm8CGHldLYibIdqXqd pk01pMxWizMfkAnbkA0eLfgCU9c4kSANkZbNUztzIggqm/nXzZ1Wxq7CoOox9O1bQhcAb+ nV5AKlMROqXeV/7P4g6jUcbHkvjZnbQe6GIINrnXzRwnVaoxVd7jJ1KG0VczKyk3QzxxF9 xxG4bDFP4MpqNUCwuzQeMLnE1n70WzFK7wxalQ0+XmuOK+LCQCF5vfEtd3+5kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=08bb51f8d60c552d1f7c202cc2eb267ed480e541 commit 08bb51f8d60c552d1f7c202cc2eb267ed480e541 Author: Konstantin Belousov AuthorDate: 2021-11-28 01:52:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-11-29 16:38:02 +0000 shutdown: unmount filesystems after swapoff Swap on file requires operational underlying mount, otherwise swapoff_all() is guaranteed to panic due to the default strategy VOP for reclaimed vnodes. Reported and tested by: peterj Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33147 --- 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 4b746a269171..8d6eac800caf 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1452,16 +1452,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 */ }