[Open-FCoE] [PATCH V2 11/13] fcoe: add mutex to protect create and destroy

Joe Eykholt jeykholt at cisco.com
Wed Jul 8 22:03:57 UTC 2009

Chris Leech wrote:
> On Wed, Jul 08, 2009 at 02:13:29PM -0700, Love, Robert W wrote:
>> On Wed, 2009-07-08 at 10:40 -0700, Chris Leech wrote:
>>> Rather than rely on the hostlist_lock to be held while creating exchange
>>> managers, serialize fcoe instance creation and destruction with a mutex.
>>> This will allow the hostlist addition to be moved out of fcoe_if_create(),
>>> which will simplify NPIV support.
>> Is there a reason that we don't use the rtnl_lock for protection? It's
>> already held when we get the NETDEV_UNREGISTER event (added in patch
>> 13/13). I believe that doing so would remove the need to defer the
>> fcoe_destroy() call since the deferral is only needed so that we don't
>> grab the rtnl_lock twice.
> Mostly I'm just not a fan of putting other people locks/mutexs to our own
> use.  I think it confuses the issue of what is the mutex protecting, but
> I don't see any technical barriers to doing it that way.
> I thought there'd be more changes required; but I thought
> dev_get_by_name() would be taking the rtnl mutex, it's not there's the
> dev_base_lock protecting the list.
> unregister_netdevice_notifier() takes rtnl, but I don't see an issue
> with re-taking the mutex after calling that in fcoe_exit().

Let's not drop and re-take it.  Instead do the unregister before
ever taking rtnl_lock.

> We take rtnl around a few netdev related calls, but those code paths are
> either pretty clearly in the create/destroy path or not.
> _______________________________________________
> devel mailing list
> devel at open-fcoe.org
> http://www.open-fcoe.org/mailman/listinfo/devel

More information about the devel mailing list