git: 933f5f616a8a - main - swapoff: release vnode held since swapon
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Nov 2026 09:58:46 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=933f5f616a8a44b7af6cdccecf959ef1e8bab66e
commit 933f5f616a8a44b7af6cdccecf959ef1e8bab66e
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-16 09:57:24 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-16 09:57:24 +0000
swapoff: release vnode held since swapon
kern_swapon looks up the proposed swap path and aquires a vnode which is
held (unlocked) throughout the life of the swap device. In the device
case (swapgeom) it was never released in the swapoff path.
Remove an incorrect comment about swapgeom_close being called from
biodone. It is only called directly via swapoff(2) or at the end of the
shutdown path.
Reviewed by: kib, markj
Reported by: llm-postcr
MFC after: 3 days
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D61465
---
sys/vm/swap_pager.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 175cbe2b1953..3bd0a3545ee6 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -3276,13 +3276,14 @@ swapgeom_close(struct thread *td, struct swdevt *sw)
sw->sw_id = NULL;
mtx_unlock(&sw_dev_mtx);
- /*
- * swapgeom_close() may be called from the biodone context,
- * where we cannot perform topology changes. Delegate the
- * work to the events thread.
- */
if (cp != NULL)
g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL);
+
+ /*
+ * Release the reference added by kern_swapon when resolving the
+ * vnode.
+ */
+ vrele(sw->sw_vp);
}
static int