• Rusty Russell's avatar
    scsi: always increment reference count · dc4515ea
    Rusty Russell authored
    James reported:
    > After e513cc1c module: Remove stop_machine from module unloading,
    > module_refcount() is returning (unsigned long)-1 when called from within
    > a routine that runs in module_exit.  This is confusing the scsi device
    > put code which is coded to detect a module_refcount() of zero for
    > running within a module exit routine and not try to do another
    > module_put.  The fix is to restore the original behaviour of
    > module_refcount() and return zero if we're running inside an exit
    > routine.
    
    The correct fix is to turn try_module_get() into __module_get(), and
    always do the module_put().
    Acked-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
    dc4515ea
scsi.c 33.6 KB