linux-hardened/fs/ocfs2/cluster
Joyce 6f8648e894 ocfs2: fix a tiny race case when firing callbacks
In o2hb_shutdown_slot() and o2hb_check_slot(), since event is defined as
local, it is only valid during the call stack.  So the following tiny race
case may happen in a multi-volumes mounted environment:

o2hb-vol1                         o2hb-vol2
1) o2hb_shutdown_slot
allocate local event1
2) queue_node_event
add event1 to global o2hb_node_events
                                  3) o2hb_shutdown_slot
                                  allocate local event2
                                  4) queue_node_event
                                  add event2 to global o2hb_node_events
                                  5) o2hb_run_event_list
                                  delete event1 from o2hb_node_events
6) o2hb_run_event_list
event1 empty, return
7) o2hb_shutdown_slot
event1 lifecycle ends
                                  8) o2hb_fire_callbacks
                                  event1 is already *invalid*

This patch lets it wait on o2hb_callback_sem when another thread is firing
callbacks.  And for performance consideration, we only call
o2hb_run_event_list when there is an event queued.

Signed-off-by: Joyce <xuejiufei@huawei.com>
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11 15:56:51 -07:00
..
heartbeat.c ocfs2: fix a tiny race case when firing callbacks 2013-09-11 15:56:51 -07:00
heartbeat.h ocfs2/cluster: Get all heartbeat regions 2010-10-07 14:31:06 -07:00
Makefile ocfs2/net: Add debug interface to o2net 2008-04-18 08:56:20 -07:00
masklog.c ocfs2: Remove masklog ML_UPTODATE. 2011-02-24 16:22:20 +08:00
masklog.h ocfs2: Make the left masklogs compat. 2011-02-21 11:19:43 +08:00
netdebug.c switch debugfs to umode_t 2012-01-03 22:54:56 -05:00
nodemanager.c ocfs2/cluster: Print messages when adding/removing nodes 2010-10-07 17:30:17 -07:00
nodemanager.h ocfs2/cluster: Make fence method configurable - v2 2009-12-02 16:49:26 -08:00
ocfs2_heartbeat.h
ocfs2_nodemanager.h ocfs2/dlm: Add message DLM_QUERY_REGION 2010-10-09 10:26:23 -07:00
quorum.c ocfs2: fix a comments typo at o2quo_hb_still_up() 2013-07-03 16:07:24 -07:00
quorum.h
sys.c ocfs2: remove the /sys/o2cb symlink 2011-05-23 23:37:14 -07:00
sys.h
tcp.c ocfs2: avoid possible NULL pointer dereference in o2net_accept_one() 2013-09-11 15:56:50 -07:00
tcp.h ocfs2/cluster: Add new function o2net_fill_node_map() 2011-07-24 10:32:54 -07:00
tcp_internal.h ocfs2/cluster: Track process message timing stats for each socket 2010-12-22 18:38:10 -08:00
ver.c ocfs2: bump version number 2008-01-25 15:05:46 -08:00
ver.h