Linux-kernel mailing list archive 2000-26,: Re: owner field in `struct fs'

# Re: owner field in `struct fs'

David Woodhouse (dwmw2@infradead.org)
Mon, 26 Jun 2000 20:49:41 +0100 (BST)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Andrea Arcangeli: "Re: mm 2.2.17pre6"
- Previous message: Jim: "Re: APIC error interrupt"

On Mon, 26 Jun 2000, Alexander Viro wrote:

> Erm... There is one case when MOD_INC_USE_COUNT is kosher and even needed,
> but it's pretty convoluted. Consider modules A, B and C.
> A provides register_foo() and unregister_foo()
> B provides foo1
> C does register_foo(&foo1) and unregister_foo(&foo1) for ioctls on
> some device.
>
> Notice that C depends on A and B, but A and B are independent. However,
> once foo1 is registered we want A to be pinned down. MOD_INC_USE_COUNT in
> register_foo() is OK here - C depends on A and if we have C around the A
> will stay there...

You, sir, have a sick mind. But my code actually _does_ things like that
so I suppose I should shut up :)

If you __MOD_INC_USE_COUNT on _registration_ then the cleanup_module
function can never get called and the module can't be unloaded. You
generally want to increase the use count when it's _USED_ not when it's
registered.

But yes - if you were to increase the use count on registration, then that
would generally be safe anyway, because the structure being registered
will generally reside in the same module as the caller of the
register_foo() function, and that should be locked in place when it's
running.

    --
    dwmw2

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

- Next message: Andrea Arcangeli: "Re: mm 2.2.17pre6"
- Previous message: Jim: "Re: APIC error interrupt"