lkml.org 
[lkml]   [2002]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] EVMS core (3/9) discover.c
From
Date

On 10/10/2002 at 03:48 PM, Andi Kleen wrote:

> > + list_for_each_entry(plugin, &plugin_head, headers) {
> > + if (GetPluginType(plugin->id) == EVMS_DEVICE_MANAGER) {
> > + spin_unlock(&plugin_lock);
> > + DISCOVER(plugin, disk_list);
> > + spin_lock(&plugin_lock);
> > + }

> How do you know "plugin" and its successors are still valid when retaking
> the spinlock? Looks like you need a reference count on the object here.

The spinlock itself should protect the integrity of the
list. If a prev or next element in the list should be
removed, while in a discover function, then the prev
or next field in the current plugin will get updated,
but I don't believe that should cause the list_for_each_entry
macro problems traversing the remainding elements in the list.

The first instruction in every plugin's discover function
is a MOD_INC_USE_COUNT and the last before the return is
MOD_DEC_USE_COUNT. So there exists a small window by
which the current plugin might be unloaded between the
spinlock release and MOD_INC_USE_COUNT, and the
MOD_DEC_USE_COUNT and the spinlock reacquire.

We plan to register a "__this_module.can_unload()" that
should prevent plugin modules from unloading during
discovery.

Mark


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

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.057 / U:1.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site