netdev: Initialize netdev_class_mutex.

This code path currently does not initialize
netdev_class_mutex.
dummy_enable
 ->netdev_dummy_register
   ->netdev_register_provider
     ->ovs_mutex_lock(&netdev_class_mutex)

ovsdb-server on windows crashes without it.

This commit adds a new initialization function.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto: Don't destroy mutex before its use.

Currently, we are calling guarded_list_destroy()
to destroy a mutex and then go ahead and use it through
delete_group
 ->delete_group__
   ->handle_flow_mod__
    ->run_rule_executes
     ->guarded_list_pop_all

The group related unit tests cause ovs-vswitchd to crash
because of this (on windows).

Calling guarded_list_destroy() after delete_group() solves the
problem.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lacp: Ensure that mutex is initialized when used in lacp_status().

If 'lacp' is NULL, then lacp_create() might not have been called to
indirectly initialize the mutex via lacp_init(), so call lacp_init()
from lacp_status().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
ovs-thread: Add checking for mutex and rwlock initialization.

With glibc, a mutex or rwlock filled with all-zero-bytes is properly
initialized for use, but this is not true for any other libc that OVS
supports.  However, OVS gets a lot more testing with glibc than any other
libc.  This means that developers keep introducing bugs that do not
manifest on the main development platform.

This commit should help avoid the problem, by reusing the existing 'where'
members to indicate whether a mutex or rwlock has been initialized.

Signed-off-by: Ben Pfaff <blp@nicira.com>