Skip to content

Commit cdd09f4

Browse files
josephhztorvalds
authored andcommitted
ocfs2: fix BUG when o2hb_register_callback fails
In dlm_register_domain_handlers, if o2hb_register_callback fails, it will call dlm_unregister_domain_handlers to unregister. This will trigger the BUG_ON in o2hb_unregister_callback because hc_magic is 0. So we should call o2hb_setup_callback to initialize hc first. Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 914a9b7 commit cdd09f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/ocfs2/dlm/dlmdomain.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,12 +1725,13 @@ static int dlm_register_domain_handlers(struct dlm_ctxt *dlm)
17251725

17261726
o2hb_setup_callback(&dlm->dlm_hb_down, O2HB_NODE_DOWN_CB,
17271727
dlm_hb_node_down_cb, dlm, DLM_HB_NODE_DOWN_PRI);
1728+
o2hb_setup_callback(&dlm->dlm_hb_up, O2HB_NODE_UP_CB,
1729+
dlm_hb_node_up_cb, dlm, DLM_HB_NODE_UP_PRI);
1730+
17281731
status = o2hb_register_callback(dlm->name, &dlm->dlm_hb_down);
17291732
if (status)
17301733
goto bail;
17311734

1732-
o2hb_setup_callback(&dlm->dlm_hb_up, O2HB_NODE_UP_CB,
1733-
dlm_hb_node_up_cb, dlm, DLM_HB_NODE_UP_PRI);
17341735
status = o2hb_register_callback(dlm->name, &dlm->dlm_hb_up);
17351736
if (status)
17361737
goto bail;

0 commit comments

Comments
 (0)