Skip to content

Commit

Permalink
mig_jcr is freed to early.
Browse files Browse the repository at this point in the history
Because the mig_jcr is already freed in the migration_cleanup() function
all info is lost when we get to the after runscript. This is a design
error so we moved the freeing of the mig_jcr now to just before the Job
actually exits and has done all its work.

Fixes #139: export command in a RunScript ressource does not get the
            correct volume when doing scheduled JobType Copy
  • Loading branch information
Marco van Wieringen committed May 5, 2013
1 parent 8b23951 commit d8d1063
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 13 additions & 1 deletion src/dird/job.c
Expand Up @@ -475,14 +475,26 @@ static void *job_thread(void *arg)

run_scripts(jcr, jcr->res.job->RunScripts, "AfterJob");

/* Send off any queued messages */
/*
* Send off any queued messages
*/
if (jcr->msg_queue && jcr->msg_queue->size() > 0) {
dequeue_messages(jcr);
}

generate_plugin_event(jcr, bDirEventJobEnd);
Dmsg1(50, "======== End Job stat=%c ==========\n", jcr->JobStatus);
Dsm_check(100);

/*
* If we have a migration JCR now is the correct time to detach it
* as we are done running.
*/
if (jcr->mig_jcr) {
free_jcr(jcr->mig_jcr);
jcr->mig_jcr = NULL;
}

return NULL;
}

Expand Down
5 changes: 0 additions & 5 deletions src/dird/migrate.c
Expand Up @@ -1427,11 +1427,6 @@ void migration_cleanup(JCR *jcr, int TermCode)
sd_term_msg,
term_code);

Dmsg1(100, "migrate_cleanup() mig_jcr=0x%x\n", jcr->mig_jcr);
if (jcr->mig_jcr) {
free_jcr(jcr->mig_jcr);
jcr->mig_jcr = NULL;
}
Dmsg0(100, "Leave migrate_cleanup()\n");
}

Expand Down

0 comments on commit d8d1063

Please sign in to comment.