Re: cn_queue.c

From: Andrew Morton
Date: Fri Apr 01 2005 - 04:52:00 EST


Evgeniy Polyakov <johnpol@xxxxxxxxxxx> wrote:
>
> cn_queue_free_dev() will wait until dev->refcnt hits zero
> before freeing any resources,
> but it can happen only after cn_queue_del_callback() does
> it's work on given callback device [actually when all callbacks
> are removed].
> When new callback is added into device, it's refcnt is incremented
> [before adition btw, if addition fails in the middle, reference is
> decremented], when callbak is removed, device's reference counter
> is decremented aromically after all work is finished.

hm.

How come cn_queue_del_callback() uses all those barriers if no other CPU
can grab new references against cbq->cb->refcnt?

cn_queue_free_callback() forgot to do flush_workqueue(), so
cn_queue_wrapper() can still be running while cn_queue_free_callback()
frees up the cn_callback_entry, I think.

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