From 831817b2373d6a38f0e202ba592507938698c4e0 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 21 Jul 2003 14:53:42 +0000 Subject: [PATCH] Fix reschedule after error deadlock git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@641 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/job.c | 4 ++-- bacula/src/dird/jobq.c | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 75ea929ffb..f4904da0da 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -144,7 +144,7 @@ void run_job(JCR *jcr) jcr->JobId = jcr->jr.JobId; ASSERT(jcr->jr.JobId > 0); - Dmsg4(30, "Created job record JobId=%d Name=%s Type=%c Level=%c\n", + Dmsg4(50, "Created job record JobId=%d Name=%s Type=%c Level=%c\n", jcr->JobId, jcr->Job, jcr->jr.Type, jcr->jr.Level); Dmsg0(200, "Add jrc to work queue\n"); @@ -160,7 +160,7 @@ void run_job(JCR *jcr) } #endif #endif - Dmsg0(200, "Done run_job()\n"); + Dmsg0(100, "Done run_job()\n"); } /* diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 4496446b00..1768939118 100755 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -428,7 +428,10 @@ static void *jobq_server(void *arg) jcr->JobStatus = JS_Created; /* force new status */ dird_free_jcr(jcr); /* partial cleanup old stuff */ if (jcr->JobBytes == 0) { + Dmsg1(100, "Requeue job=%d\n", jcr->JobId); + V(jq->mutex); jobq_add(jq, jcr); /* queue the job to run again */ + P(jq->mutex); free(je); /* free the job entry */ continue; } @@ -446,14 +449,19 @@ static void *jobq_server(void *arg) njcr->pool = jcr->pool; njcr->store = jcr->store; njcr->messages = jcr->messages; + Dmsg0(100, "Call to run new job\n"); + V(jq->mutex); run_job(njcr); + P(jq->mutex); + Dmsg0(100, "Back from running new job.\n"); } /* Clean up and release old jcr */ if (jcr->db) { - Dmsg0(200, "Close DB\n"); + Dmsg0(100, "Close DB\n"); db_close_database(jcr, jcr->db); jcr->db = NULL; } + Dmsg1(100, "====== Termination job=%d\n", jcr->JobId); free_jcr(jcr); free(je); /* release job entry */ } -- 2.39.5