[openib-general] [PATCH] ib_cm: fix module unload race with timewait
Roland Dreier
rdreier at cisco.com
Fri Sep 29 17:10:05 PDT 2006
Some of these spin_lock_irqsave()s are too conservative. For example:
> static void __exit ib_cm_cleanup(void)
> {
> + struct cm_timewait_info *timewait_info;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&cm.lock, flags);
> + list_for_each_entry(timewait_info, &cm.timewait_list, list)
> + cancel_delayed_work(&timewait_info->work.work);
> + spin_unlock_irqrestore(&cm.lock, flags);
> +
> destroy_workqueue(cm.wq);
destroy_workqueue() can only be called in process context -- so it
is fine to just use spin_lock_irq() above.
> +
> + while (!list_empty(&cm.timewait_list)) {
> + timewait_info = container_of(cm.timewait_list.next,
> + struct cm_timewait_info, list);
> + list_del(&timewait_info->list);
> + kfree(timewait_info);
> + }
list_for_each_entry_safe() here? I assume nothing is getting added to
the list while the loop runs...
> +
> ib_unregister_client(&cm_client);
> idr_destroy(&cm.local_id_table);
> }
More information about the general
mailing list