[ovs-dev] [PATCH v2 6/6] vlog: Use log_file_mutex to more consistently protect vlog_modules.

Russell Bryant russell at ovn.org
Wed Feb 10 21:32:33 UTC 2016


On 02/03/2016 04:50 PM, Ben Pfaff wrote:
> This could be beneficial if we ever insert a new module at runtime
> (currently we only insert them at startup) and it should have negligible
> cost.
> 
> Suggested-by: Russell Bryant <russell at ovn.org>
> Signed-off-by: Ben Pfaff <blp at ovn.org>

Acked-by: Russell Bryant <russell at ovn.org>

> @@ -104,13 +101,18 @@ DEFINE_STATIC_PER_THREAD_DATA(unsigned int, msg_num, 0);
>   *
>   * All of the following is protected by 'log_file_mutex', which nests inside
>   * pattern_rwlock. */
> -static struct ovs_mutex log_file_mutex = OVS_MUTEX_INITIALIZER;
> +static struct ovs_mutex log_file_mutex OVS_ACQ_AFTER(pattern_rwlock)
> +    = OVS_MUTEX_INITIALIZER;

btw, I *love* these macros enabling thread safety attributes from clang.
 They probably would have saved me a lot of pain in a previous life.

-- 
Russell Bryant



More information about the dev mailing list