This repository has been archived by the owner on May 3, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fdmi: fix source dock fom wakeup race
Existing code: * fdmi source dock from (fdmi_sd_fom_tick()) waits in FDMI_SRC_DOCK_FOM_PHASE_WAIT after fdmi record list was exhausted; * fdmi source deck timer fom (fdmi_sd_timer_fom_tick()) loops in FDMI_SRC_DOCK_TIMER_FOM_PHASE_WAIT->FDMI_SRC_DOCK_TIMER_FOM_PHASE_ALARMED phases, waking the source dock fom periodically. This wakeup is done via an ast and there is no synchronisation to guarantee that ast execution completes before the ast is posted again. This leads to the spurious UT failures: Thread 5 (Thread 0x7f08a07f8700 (LWP 1686367)): m0_debugger_invoke () at lib/user_space/uassert.c:153 m0_arch_panic (c=0x7f08ae448280 <signal_panic>, ap=0x7f08a07f6eb8) at lib/user_space/uassert.c:129 m0_panic (ctx=0x7f08ae448280 <signal_panic>) at lib/assert.c:52 sigsegv (sig=11) at lib/user_space/ucookie.c:52 <signal handler called> ?? () m0_sm_asts_run (grp=0x16a9010) at sm/sm.c:175 loc_handler_thread (th=0x16a74b0) at fop/fom.c:925 (gdb) up 6 175 M0_ADDB2_HIST(grp->s_addb2->ga_forq, (gdb) p *ast $6 = {sa_cb = 0x7f08ade110ca <wakeup_iff_waiting>, sa_datum = 0x7f08ae5a2f18 <fdmi_global_src_dock+152>, sa_next = 0x7f08aee4d620 <eoq>, sa_mach = 0x0} (gdb) disassemble m0_sm_asts_run Dump of assembler code for function m0_sm_asts_run: 0x00007f08adf9d6d3 <+0>: push %rbp 0x00007f08adf9d6d4 <+1>: mov %rsp,%rbp ... 0x00007f08adf9d865 <+402>: mov (%rax),%rax 0x00007f08adf9d868 <+405>: mov -0x8(%rbp),%rcx 0x00007f08adf9d86c <+409>: mov -0x58(%rbp),%rdx 0x00007f08adf9d870 <+413>: mov %rcx,%rsi 0x00007f08adf9d873 <+416>: mov %rdx,%rdi 0x00007f08adf9d876 <+419>: callq *%rax => 0x00007f08adf9d878 <+421>: callq 0x7f08adce6210 <m0_time_now@plt> 0x00007f08adf9d87d <+426>: mov %rax,-0x30(%rbp) ... (gdb) info registers rax rax 0x0 0 That is, ast->sa_cb was re-assigned from NULL to wakeup_iff_waiting, right at the moment of crash. Fix: instead of using ast, directly wake up the from by introducing a special channel fdmi_sd_fom::fsf_wake. Signed-off-by: Nikita Danilov <nikita.danilov@seagate.com>
- Loading branch information