You are saying that we can omit locking because this is
called only from a module-exit function, and thus protected
by the module_mutex semaphore? (I must defer to
others who have a better handle on modules...)
If in fact only one module-exit function can be
executing at a given time, then we should be able to
use the following approach:
void unregister_snap_client(struct datalink_proto *proto)
{
list_del_rcu(&proto->node); /* protected by module_mutex. */
synchronize_kernel();
kfree(proto);
}
If multiple module-exit functions can somehow execute
concurrently, then something like the following would
be needed:
void unregister_snap_client(struct datalink_proto *proto)
{
spin_lock_bh(&snap_lock);
list_del_rcu(&proto->node);
spin_unlock_bh(&snap_lock);
synchronize_kernel();
kfree(proto);
}
Module unloading should be rare enough to tolerate
the grace period under the module_mutex, right?
Thoughts?
Thanx, Paul
-
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/