bugfix: possible infinite loop in wait_for_log_permanent().
add state field to bio_wrapper struct for debug.