diff options
| author | Alex Richardson <arichardson@FreeBSD.org> | 2026-05-07 04:21:23 +0000 |
|---|---|---|
| committer | Alex Richardson <arichardson@FreeBSD.org> | 2026-05-07 04:23:03 +0000 |
| commit | 3fe5069ce2bf5b2702f3be6531ce6a05c584e64d (patch) | |
| tree | 25b48f9b97dcdb3c72350755c11524a7baa7fb3b | |
| parent | 3daa43b1bb2cf68f32993e342f59eb146afb7c24 (diff) | |
| -rw-r--r-- | sys/dev/virtio/p9fs/virtio_p9fs.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 2b276a60aa9a..f76b135c042d 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -464,16 +464,22 @@ static int vt9p_modevent(module_t mod, int type, void *unused) { int error; + static int loaded = 0; error = 0; switch (type) { case MOD_LOAD: - p9_init_zones(); - p9_register_trans(&vt9p_trans); + if (loaded++ == 0) { + p9_init_zones(); + p9_register_trans(&vt9p_trans); + } break; case MOD_UNLOAD: - p9_destroy_zones(); + if (--loaded == 0) { + p9_unregister_trans(&vt9p_trans); + p9_destroy_zones(); + } break; case MOD_SHUTDOWN: break; |
