Re: Module variable initialization
- Reply: Rick Macklem : "Re: Module variable initialization"
- In reply to: Rick Macklem : "Module variable initialization"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Dec 2024 09:46:40 UTC
> On Dec 12, 2024, at 10:44 AM, Rick Macklem <rick.macklem@gmail.com> wrote: > > Hi, > > Bugzilla pr#282156 reports a crash that appears to be caused by > a NFS client variable (nfscbd_pool) not being initialized when a > NFS mount is done. > > Now, the NFS client module (nfscl.ko) is weird in that it has > two definitions for the module. There is a VFS_SET() one for > the file system and a separate DECLARE_MODULE() for nfscl. > (The latter exists so that the module can refuse to unload and > define dependencies on other modules.) > > The variable (nfscbd_pool) is initialized in the modevent() function > for nfscl in the MOD_LOAD section. > > Does anyone know if this can somehow result in the variable not > being initialized when an NFS mount occurs? I'm not familiar with NFS. From a quick look of the source code I think `nfscbd_pool` is correctly initialized. I do not know the exact version pr#282156, so I guess and tried 14.1-p1, ``` $ addr2line -fip -e /.zfs/snapshot/14.1-p1/usr/lib/debug/boot/kernel/kernel.debug 0xffffffff80e1c558 svc_run at /usr/src/sys/rpc/svc.c:1414 ``` https://cgit.freebsd.org/src/tree/sys/rpc/svc.c?h=releng/14.1&id=0892dff104440867956a53e78c12d66090fec36b#n1414 If `nfscbd_pool` is NULL, then I expect the panic should happens earlier. Say line 1405 or event earlier line 1389 . Maybe `svc_run_internal()` is to be blamed ? > > And, if the above is possible, would doing the initialization in the > vfs_init function for VFS_SET() be guaranteed to happen before > a mount is done? The order of modules seems right to me. nfscl module has order SI_ORDER_FIRST and VFS_SET(... nfs ... ) has SI_ORDER_MIDDLE. > > Thanks for any help with this, rick > Best regards, Zhenlei