git: 1ed2ef42e017 - main - p9fs: Move UMA zone initialization to VFS module lifecycle
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 May 2026 05:02:54 UTC
The branch main has been updated by arichardson:
URL: https://cgit.FreeBSD.org/src/commit/?id=1ed2ef42e01771f5d8ca9be61e07dcf0fd47feba
commit 1ed2ef42e01771f5d8ca9be61e07dcf0fd47feba
Author: Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2026-05-07 04:21:50 +0000
Commit: Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2026-05-07 04:23:04 +0000
p9fs: Move UMA zone initialization to VFS module lifecycle
Previously, the UMA zones required for 9P requests (p9fs_buf_zone,
p9fs_req_zone, etc.) were initialized and destroyed in the
virtio_p9fs transport module. This caused issues when unloading
the core p9fs module.
This change moves p9_init_zones() and p9_destroy_zones() into
p9fs_init() and p9fs_uninit() inside p9fs_vfsops.c so that they
are correctly bound to the VFS filesystem module lifecycle via
vfs_modevent, aligning p9fs with standard FreeBSD VFS semantics.
Found while fixing https://github.com/CTSRD-CHERI/cheribsd/issues/2617.
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D56492
---
sys/dev/virtio/p9fs/virtio_p9fs.c | 3 +--
sys/fs/p9fs/p9fs_vfsops.c | 4 ++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c
index f76b135c042d..19a32fea458e 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -471,14 +471,12 @@ vt9p_modevent(module_t mod, int type, void *unused)
switch (type) {
case MOD_LOAD:
if (loaded++ == 0) {
- p9_init_zones();
p9_register_trans(&vt9p_trans);
}
break;
case MOD_UNLOAD:
if (--loaded == 0) {
p9_unregister_trans(&vt9p_trans);
- p9_destroy_zones();
}
break;
case MOD_SHUTDOWN:
@@ -487,6 +485,7 @@ vt9p_modevent(module_t mod, int type, void *unused)
error = EOPNOTSUPP;
break;
}
+
return (error);
}
diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c
index 0e09c58e57b6..a0f0a5a4e494 100644
--- a/sys/fs/p9fs/p9fs_vfsops.c
+++ b/sys/fs/p9fs/p9fs_vfsops.c
@@ -119,6 +119,8 @@ p9fs_init(struct vfsconf *vfsp)
p9fs_io_buffer_zone = uma_zcreate("p9fs io_buffer zone",
P9FS_MTU, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+ p9_init_zones();
+
return (0);
}
@@ -127,6 +129,8 @@ static int
p9fs_uninit(struct vfsconf *vfsp)
{
+ p9_destroy_zones();
+
uma_zdestroy(p9fs_node_zone);
uma_zdestroy(p9fs_io_buffer_zone);
uma_zdestroy(p9fs_getattr_zone);