lkml.org 
[lkml]   [1997]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectuse 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

\
 
 \ /
  Last update: 2005-03-22 13:40    [from the cache]
©2003-2011 Jasper Spaans