It seems that the trunk_set_super_block() function is based on the assumption, "init means destroying the current super block". So, it is used in both creating and destroying the database. One way to resolve this is setting the addresses of log and log metadata to 0 if spl->log is NULL, which can indicate that the database is being unmounted.
I got a segmentation fault error in
trunk_unmount()
. https://github.com/vmware/splinterdb/blob/6a2348c0eb9887cdafee3dad674a96e41edddb28/src/trunk.c#L7725-L7746 This function callstrunk_prepare_for_shutdown(spl);
, followed bytrunk_set_super_block(spl, FALSE, TRUE, FALSE);
.In the
trunk_prepare_for_shutdown()
,spl->log
is freed and then becomes NULL byplatform_free()
. https://github.com/vmware/splinterdb/blob/6a2348c0eb9887cdafee3dad674a96e41edddb28/src/trunk.c#L7646 However, thespl->log
is referenced bytrunk_set_super_block()
, which causes a segmentation fault. https://github.com/vmware/splinterdb/blob/6a2348c0eb9887cdafee3dad674a96e41edddb28/src/trunk.c#L934It seems that the
trunk_set_super_block()
function is based on the assumption, "init means destroying the current super block". So, it is used in both creating and destroying the database. One way to resolve this is setting the addresses of log and log metadata to 0 ifspl->log
is NULL, which can indicate that the database is being unmounted.