Re: [PATCH] Export current_is_keventd() for libphy

Roland Dreier
2006-12-05T23:52:19Z

> Ah. The point is that the phy code doesn't want to flush _all_ pending
> callbacks. It only wants to flush its own one. And its own one doesn't
> take rtnl_lock().

OK, got it. You're absolutely correct.

> Maybe the lesson here is that flush_scheduled_work() is a bad function.
> It should really be flush_this_work(struct work_struct *w). That is in
> fact what approximately 100% of the flush_scheduled_work() callers actually
> want to do.

I think flush_this_work() runs into trouble if it means "make sure
everything up to <this work> has completed" because it still syncs
with everything before <this work>, which has the same risk of
deadlock. And I'm not totally sure everyone who does
flush_scheduled_work() really means "cancel my work" -- they might mean
"finish up my work".

For example I would have to do some archeology to remember exactly
what I needed flush_scheduled_work() when I wrote drivers/infiniband/ulp/ipoib

- R.