trace: do not shm_unlink if tracepoints were specified
This allows us to use the tracepoints as forensics when a crash occurs - basically a high-powered trace buffer. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I27f6c7a196501b4100cfc19c0354f2c6095ff3bb Reviewed-on: https://review.gerrithub.io/424282 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
aa37b4f9d5
commit
8b6826536c
@ -128,10 +128,23 @@ trace_init_err:
|
||||
void
|
||||
spdk_trace_cleanup(void)
|
||||
{
|
||||
if (g_trace_histories) {
|
||||
munmap(g_trace_histories, sizeof(struct spdk_trace_histories));
|
||||
g_trace_histories = NULL;
|
||||
close(g_trace_fd);
|
||||
bool unlink;
|
||||
|
||||
if (g_trace_histories == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Only unlink the shm if there were no tracepoints enabled. This ensures the file
|
||||
* can be used after this process exits/crashes for debugging.
|
||||
* Note that we have to calculate this value before g_trace_histories gets unmapped.
|
||||
*/
|
||||
unlink = spdk_mem_all_zero(g_trace_flags->tpoint_mask, sizeof(g_trace_flags->tpoint_mask));
|
||||
munmap(g_trace_histories, sizeof(struct spdk_trace_histories));
|
||||
g_trace_histories = NULL;
|
||||
close(g_trace_fd);
|
||||
|
||||
if (unlink) {
|
||||
shm_unlink(g_shm_name);
|
||||
}
|
||||
shm_unlink(g_shm_name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user