[openib-general] Re: Re: RFC: revert module ref counting patches

Michael S. Tsirkin mst at mellanox.co.il
Mon Apr 10 10:56:32 PDT 2006


Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
> Subject: Re: Re: RFC: revert module ref counting patches
> 
> Michael S. Tsirkin wrote:
> >BTW, how about the trick of exporting 
> >module_mutex_lock/module_mutex_unlock?
> >Its a really simple approach - do you think this will be acceptable?
> 
> Who exports these calls, and who calls them?

The idea is to add this to kernel/module.c:

void module_mutex_lock(void)
{
	down(&module_mutex);
}

void module_mutex_unlock(void)
{
	up(&module_mutex);
}

EXPORT_SYMBOL_GPL(module_mutex_lock);
EXPORT_SYMBOL_GPL(module_mutex_unlock);


----------------------

And now ib_sa can just

	module_mutex_lock()
	query->callback(..)
	module_mutex_unlock()

to prevent modules from unloading while callback is in progress.

Same for other modules that use callbacks without registration, like ib_addr.

-- 
MST



More information about the general mailing list