Module variable initialization

From: Rick Macklem <rick.macklem_at_gmail.com>
Date: Thu, 12 Dec 2024 02:44:53 UTC
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?

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?

Thanks for any help with this, rick