[lkml]   [1998]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    SubjectRe: More info on 104 oops [probably procfs bug]
    On Sun, 7 Jun 1998, Bill Hawes wrote:

    >Andrea Arcangeli wrote:
    >> Did you remember if your shall was leaving in /proc/parport while you
    >> rmmoded parport? If so this is a procfs bug that I reported some time ago
    >> and it' s reproducible from evey module that register a directory
    >> somewhere in /proc.
    >Hi Andrea,
    >Quite a while back I added a mechanism to /proc so that modules can have
    >their use counts incremented when a /proc directory is being referenced. This
    >prevents the problems with having a module removed while a shell or other
    >application is sitting in the module's /proc directory.

    I wasn' t aware of that.

    >The way it works is that the module defines a fill_inode function that gets
    >called when an inode is used or unused by /proc. This function then
    >increments or decrements the mod use count as appropriate.
    >See the binfmt_misc modules for details ... it's easy to add support, just a
    >few lines of code. But since /proc does provide the support for use count
    >callbacks, any bugs due to modules being removed prematurely should be
    >attributed to the module, not to /proc.

    Yes, if so I was wrong...

    Here the patch against 2.1.104 that fix the parport-procfs bug, seems to
    works like a charm, thanks Bill!

    This patch should be applyed to the mainstream kernel, Linus.

    --- linux/drivers/misc/parport_procfs.c 1998/06/07 19:46:54 1.1
    +++ linux/drivers/misc/parport_procfs.c 1998/06/07 19:52:26
    @@ -229,10 +229,31 @@
    return ent;

    +#ifdef MODULE
    + * This is called as the fill_inode function when an inode
    + * is going into (fill = 1) or out of service (fill = 0).
    + * We use it here to manage the module use counts.
    + *
    + * Note: only the top-level directory needs to do this; if
    + * a lower level is referenced, the parent will be as well.
    + */
    +static void parport_procfs_modcount(struct inode *inode, int fill)
    + if (fill)
    + inc_parport_count();
    + else
    + dec_parport_count();

    int parport_proc_init(void)
    base = new_proc_entry("parport", S_IFDIR, &proc_root,PROC_PARPORT);
    +#ifdef MODULE
    + base->fill_inode = &parport_procfs_modcount;

    if (base == NULL) {
    printk(KERN_ERR "Unable to initialise /proc/parport.\n");
    Andrea[s] Arcangeli

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to

     \ /
      Last update: 2005-03-22 13:43    [W:0.024 / U:3.500 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site