Messages in this thread | | | Date | Thu, 02 Oct 1997 12:49:17 -0400 | From | Bill Hawes <> | Subject | use counts for /proc modules |
| |
In my ongoing cleanup of the /proc fs I'd like to fix the problem of modules being unloaded while the fs still holds references to code or data structures. The problem arises because module use counts are currently being incremented only for "active" uses -- e.g. while the read routine is being called. If someone is just cd'ed to a directory and the module unloads, you've got trouble.
With the use count tracking I've added for proc_dir_entries I can tell when the last use is released, but this needs to be translated into an appropriate MOD_DEC_USE_COUNT. The only way I can think to do this is to add another function pointer to proc_dir_entry that would increment or decrement the module count. Permanent entries or non-module code could leave it as NULL or just an empty function. The code might be something like
void mod_use_count(int up) { if (up) MOD_INC_USE_COUNT; else MOD_DEC_USE_COUNT; }
This would require adding the routine to each module, but on the other hand would simplify module use count tracking, as you wouldn't need it in the read/write/etc routines.
Does this seem reasonable, or can anyone else think of a better way?
Regards, Bill
| |