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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user