Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit e990e6f

Browse files
author
Nikita Danilov
authored
m0_confc_init_wait(): initialise bob earlier (#1759)
confc->cc_magic must be initialised earlier, otherwise m0_confc_invariant() fails: spiel-conf-ut big-db motr[22808]: 4a30 FATAL [lib/assert.c:50:m0_panic] panic: (m0_confc_invariant(confc)) at m0_confc_ctx_init() (conf/confc.c:648) [git: 2.0.0-713-42-g7bcc873c-dirty] /var/motr/m0ut/m0trace.22808 Thread 11 (Thread 0x7fffe4875700 (LWP 22856)): raise () from /lib64/libc.so.6 abort () from /lib64/libc.so.6 m0_arch_panic (c=0x7fffec2a39a0 <__pctx.21695>, ap=0x7fffe4874ac8) at lib/user_space/uassert.c:131 m0_panic (ctx=0x7fffec2a39a0 <__pctx.21695>) at lib/assert.c:52 m0_confc_ctx_init (ctx=0x7fff9002e8a8, confc=0x7ffff7d88268 <ut_reqh+44744>) at conf/confc.c:648 rm_ha_conf_open (grp=0x75cc20, ast=0x7fff9002ec10) at rm/rm_ha.c:256 m0_sm_asts_run (grp=0x75cc20) at sm/sm.c:175 loc_handler_thread (th=0x714380) at fop/fom.c:941 m0_thread_trampoline (arg=0x714388) at lib/thread.c:117 Signed-off-by: Nikita Danilov <[email protected]>
1 parent f60c3f8 commit e990e6f

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

conf/confc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static const struct m0_bob_type confc_bob = {
412412
.bt_magix = M0_CONFC_MAGIC,
413413
.bt_check = _confc_check
414414
};
415-
M0_BOB_DEFINE(static, &confc_bob, m0_confc);
415+
M0_BOB_DEFINE(M0_INTERNAL, &confc_bob, m0_confc);
416416

417417
static const struct m0_bob_type ctx_bob = {
418418
.bt_name = "m0_confc_ctx",
@@ -524,6 +524,7 @@ M0_INTERNAL int m0_confc_init_wait(struct m0_confc *confc,
524524
M0_LOG(M0_DEBUG, "confd=%s lconf=%s", confd_addr, local_conf);
525525

526526
m0_mutex_init(&confc->cc_lock);
527+
m0_confc_bob_init(confc);
527528
confc_lock(confc);
528529
rc = confc_cache_create(confc, local_conf);
529530
confc_unlock(confc);
@@ -539,7 +540,6 @@ M0_INTERNAL int m0_confc_init_wait(struct m0_confc *confc,
539540
if (rc == 0) {
540541
confc->cc_group = sm_group;
541542
confc->cc_nr_ctx = 0;
542-
m0_confc_bob_init(confc);
543543
m0_mutex_init(&confc->cc_unatt_guard);
544544
m0_chan_init(&confc->cc_unattached, &confc->cc_unatt_guard);
545545
confc->cc_gops = NULL;

conf/confc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,5 +820,7 @@ M0_INTERNAL bool m0_confc_is_online(const struct m0_confc *confc);
820820
M0_INTERNAL struct m0_rpc_conn *m0_confc2conn(struct m0_confc *confc);
821821
M0_INTERNAL struct m0_rpc_session *m0_confc2sess(struct m0_confc *confc);
822822

823+
M0_BOB_DECLARE(M0_INTERNAL, m0_confc);
824+
823825
/** @} confc_dfspec */
824826
#endif /* __MOTR_CONF_CONFC_H__ */

conf/rconfc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,6 +2907,7 @@ M0_INTERNAL int m0_rconfc_init(struct m0_rconfc *rconfc,
29072907
m0_mutex_init(&rconfc->rc_herd_lock);
29082908
m0_chan_init(&rconfc->rc_herd_chan, &rconfc->rc_herd_lock);
29092909
m0_sm_init(&rconfc->rc_sm, &rconfc_sm_conf, M0_RCS_INIT, sm_group);
2910+
m0_confc_bob_init(&rconfc->rc_confc);
29102911

29112912
/* Subscribe on ha entrypoint callbacks */
29122913
ha = m0_get()->i_ha;

spiel/ut/spiel_conf_ut.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ static void spiel_conf_ut_init(void)
200200
/* Use a copy of conf.xc file as confd path - file may have changed */
201201
m0_spiel__ut_init(&spiel, "tmp-conf.xc", false);
202202
m0_rconfc_lock(rconfc);
203+
m0_confc_bob_init(&rconfc->rc_confc);
203204
rconfc->rc_expired_cb = &m0_confc_expired_cb;
204205
rconfc->rc_ready_cb = &m0_confc_ready_cb;
205206
m0_rconfc_unlock(rconfc);

0 commit comments

Comments
 (0)