Re: [PATCH 1/3] net/bridge/br_if.c: don't use _WORK_NAR

From: David Howells
Date: Mon Feb 19 2007 - 08:15:40 EST


Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> > Called by what? Something outside of br_if.c?
>
> No. if cancel_delayed_work() fails, the work may sit pending in cwq->worklist,
> or it may be running right now, waiting for rtnl_mutex.

OIC. I understood "called" to mean "scheduled", but that's not what you meant.

> > Hmmm... cancel_delayed_work() in del_nbp() probably ought to be followed by
> > a flush_scheduled_work().
>
> Yes, but this deadlocks: we hold rtnl_mutex, and work->func() takes it too.

Oh, yuck!

Hmmm... You've got a work_struct (well, a delayed_work actually) - can you
just punt the destruction of the object over to keventd to perform, I wonder?

The big problem with that that I see is that the workqueue facility has no
guards in place against a work_struct's handler function running on several
CPUs at once in response to the same work_struct.

> I think the fix should be so that port_carrier_check() does get/put on
> "struct net_bridge_port" (container), but not on "struct net_device", and

I'm not sure how this helps. You still have to get rid of the net_device at
some point.

David
-
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/