/*===========================================================================* * sef_cb_init_lu * *===========================================================================*/ static int sef_cb_init_lu(int type, sef_init_info_t *info) { /* This function is called in the new VFS instance during a live update. */ int r; /* Perform regular state transfer. */ if ((r = SEF_CB_INIT_LU_DEFAULT(type, info)) != OK) return r; /* Recreate worker threads, if necessary. */ switch (info->prepare_state) { case SEF_LU_STATE_REQUEST_FREE: case SEF_LU_STATE_PROTOCOL_FREE: worker_init(); } return OK; }
/*===========================================================================* * sef_cb_init_lu * *===========================================================================*/ static int sef_cb_init_lu(int type, sef_init_info_t *info) { /* Start a new version of the reincarnation server. */ int r; struct rproc *old_rs_rp, *new_rs_rp; assert(info->endpoint == RS_PROC_NR); /* Perform default state transfer first. */ sef_setcb_init_restart(SEF_CB_INIT_RESTART_STATEFUL); r = SEF_CB_INIT_LU_DEFAULT(type, info); if(r != OK) { printf("SEF_CB_INIT_LU_DEFAULT failed: %d\n", r); return r; } /* New RS takes over. */ old_rs_rp = rproc_ptr[_ENDPOINT_P(RS_PROC_NR)]; new_rs_rp = rproc_ptr[_ENDPOINT_P(info->old_endpoint)]; if(rs_verbose) printf("RS: %s is the new RS after live update\n", srv_to_string(new_rs_rp)); /* Update the service into the replica. */ r = update_service(&old_rs_rp, &new_rs_rp, RS_DONTSWAP, 0); if(r != OK) { printf("update_service failed: %d\n", r); return r; } /* Check if everything is as expected. */ assert(RUPDATE_IS_UPDATING()); assert(RUPDATE_IS_INITIALIZING()); assert(rupdate.num_rpupds > 0); assert(rupdate.num_init_ready_pending > 0); return OK; }