Hi Jan >>> Jan Friesse <jfriesse@xxxxxxxxxx> 09/26/14 5:12 PM >>> >So can you please describe me what are you trying to fix (test case)? >Are really all locks/unlocks you've implemented needed? How did you >tested patch? Didn't deadlock happened? I have one corosync core dump issue, and according to the stack I think it related to lock/unlock incorrect using, so I checked the code and modified all the incorrect place. the stack as below: ------------------------------------ (gdb) bt #0 0x00007f12bd5fc138 in object_key_increment (object_handle=1750143901185867924, key_name=0x7f12c10044a4, key_len=8, value=0x7f12c1aedb14) at objdb.c:1088 #1 0x0000000000405847 in corosync_stats_increment_value (handle=1750143901185867924, name=0x7f12c10044a4 "requests") at main.c:1269 #2 0x00007f12c1002cf7 in pthread_ipc_consumer (conn=0x6a7f60) at coroipcs.c:719 #3 0x00007f12c0807e76 in check_list (l=<optimized out>) at allocatestack.c:835 #4 __reclaim_stacks () at allocatestack.c:850 #5 0x0000000000000000 in ?? () (gdb) p *instance->key_head.next $15 = {next = 0x6a1008, prev = 0x6a7090} (gdb) p *(*instance->key_head.next).next $16 = {next = 0x69b8d8, prev = 0x6a0ee8} (gdb) p *(*(*instance->key_head.next).next).next $17 = {next = 0x69b958, prev = 0x6a1008} (gdb) p &instance->key_head $18 = (struct list_head *) 0x6a7090 (gdb) p *(*(*(*instance->key_head.next).next).next).next $19 = {next = 0x7f12b03fe150 <cpg_pd_list_head>, prev = 0x69b8d8}------------------------------------ Regards, Xia, Li xia li napsal(a): > patch for v1.4.7 > > Signed-off-by: xia li <xli@xxxxxxxx> > --- > exec/objdb.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/exec/objdb.c b/exec/objdb.c > index 5d7c124..1a0b2fb 100644 > --- a/exec/objdb.c > +++ b/exec/objdb.c > @@ -1412,7 +1412,7 @@ static int object_priv_get ( > int res; > struct object_instance *object_instance; > > - objdb_unlock(); > + objdb_lock(); > res = hdb_handle_get (&object_instance_database, > object_handle, (void *)&object_instance); > if (res != 0) { > @@ -1723,9 +1723,12 @@ static int object_track_start(hdb_handle_t object_handle, > unsigned int res; > struct object_tracker * tracker_pt; > > + objdb_lock(); > + > res = hdb_handle_get (&object_instance_database, > object_handle, (void *)&instance); > if (res != 0) { > + objdb_unlock(); > return (res); > } > tracker_pt = malloc(sizeof(struct object_tracker)); > @@ -1746,6 +1749,7 @@ static int object_track_start(hdb_handle_t object_handle, > > hdb_handle_put (&object_instance_database, object_handle); > > + objdb_unlock(); > return (res); > } > > @@ -1762,6 +1766,8 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn > struct list_head *obj_list, *tmp_obj_list; > unsigned int res; > > + objdb_lock(); > + > /* go through the global list and find all the trackers to stop */ > for (list = objdb_trackers_head.next, tmp_list = list->next; > list != &objdb_trackers_head; list = tmp_list, tmp_list = tmp_list->next) { > @@ -1796,6 +1802,7 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn > free(tracker_pt); > } > } > + objdb_unlock(); > } > > static int object_dump(hdb_handle_t object_handle, > @@ -1852,10 +1859,11 @@ static int object_reload_config(int flush, const char **error_string) > int res; > > main_get_config_modules(&modules, &num_modules); > - object_reload_notification(OBJDB_RELOAD_NOTIFY_START, flush); > > objdb_lock(); > > + object_reload_notification(OBJDB_RELOAD_NOTIFY_START, flush); > + > for (i=0; i<num_modules; i++) { > if (modules[i]->config_reloadconfig) { > res = modules[i]->config_reloadconfig(&objdb_iface, flush, error_string); > @@ -1866,8 +1874,10 @@ static int object_reload_config(int flush, const char **error_string) > } > } > } > - objdb_unlock(); > + > object_reload_notification(OBJDB_RELOAD_NOTIFY_END, flush); > + > + objdb_unlock(); > return 0; > } > > _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss