Hi Paulo and David, > On Apr 8, 2025, at 8:05 AM, Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > > David Howells <dhowells@xxxxxxxxxx> writes: > >> Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: >> >>> (2) There's a wrong assumption in the API that @netfs_request_pool and >>> @netfs_subrequest_pool will always be initialized. For example, we >>> should return an error from netfs_alloc_[sub]rquest() functions in case >>> @mempool == NULL. >> >> No. The assumption is correct. The problem is that if the module is built in >> (ie. CONFIG_NETFS_SUPPORT=y), then there is no consequence of netfs_init() >> failing - and fail it does if CONFIG_PROC_FS=n - and 9p, afs and cifs will >> call into it anyway, despite the fact it deinitialised itself. >> >> It should marked be module_init(), not fs_initcall(). > > Makes sense, thanks. I tried to reproduce it with cifs.ko and it didn't > oops as netfslib ended up not using the default memory pools as cifs.ko > already provide its own memory pools via netfs_request_ops. Thanks for the review. I guess we will need the following changes, probably in two separate patches? Thanks, Song diff --git c/fs/netfs/main.c w/fs/netfs/main.c index 4e3e62040831..e12f7575e657 100644 --- c/fs/netfs/main.c +++ w/fs/netfs/main.c @@ -127,11 +127,13 @@ static int __init netfs_init(void) if (mempool_init_slab_pool(&netfs_subrequest_pool, 100, netfs_subrequest_slab) < 0) goto error_subreqpool; +#ifdef CONFIG_PROC_FS if (!proc_mkdir("fs/netfs", NULL)) goto error_proc; if (!proc_create_seq("fs/netfs/requests", S_IFREG | 0444, NULL, &netfs_requests_seq_ops)) goto error_procfile; +#endif #ifdef CONFIG_FSCACHE_STATS if (!proc_create_single("fs/netfs/stats", S_IFREG | 0444, NULL, netfs_stats_show)) @@ -157,7 +159,7 @@ static int __init netfs_init(void) error_req: return ret; } -fs_initcall(netfs_init); +module_init(netfs_init); static void __exit netfs_exit(void) {