From: Ben Pfaff Date: Tue, 29 Apr 2014 21:44:39 +0000 (-0700) Subject: ovs-rcu: Log the name of the main thread as "main" instead of "". X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~43 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=0d593ee424de4bb9e3d4dbe7d81c126a4efaa267 ovs-rcu: Log the name of the main thread as "main" instead of "". The main thread has the empty string as its name, but that's not a good log string. Without this patch we can get log message like blocked 1000 ms waiting for to quiesce from ovsrcu_synchronize(). Signed-off-by: Ben Pfaff Acked-by: Alex Wang --- diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c index 8a1256428..7aed6dbe5 100644 --- a/lib/ovs-rcu.c +++ b/lib/ovs-rcu.c @@ -71,11 +71,13 @@ ovsrcu_perthread_get(void) perthread = pthread_getspecific(perthread_key); if (!perthread) { + const char *name = get_subprogram_name(); + perthread = xmalloc(sizeof *perthread); ovs_mutex_init(&perthread->mutex); perthread->seqno = seq_read(global_seqno); perthread->cbset = NULL; - ovs_strlcpy(perthread->name, get_subprogram_name(), + ovs_strlcpy(perthread->name, name[0] ? name : "main", sizeof perthread->name); ovs_mutex_lock(&ovsrcu_threads_mutex);