]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix reschedule after error deadlock
authorKern Sibbald <kern@sibbald.com>
Mon, 21 Jul 2003 14:53:42 +0000 (14:53 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 21 Jul 2003 14:53:42 +0000 (14:53 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@641 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/job.c
bacula/src/dird/jobq.c

index 75ea929ffbe15befc397d4216e52955f74a05b18..f4904da0da8a8e4a9788a0ffd50bec000f4932b8 100644 (file)
@@ -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");
 }
 
 /* 
index 4496446b00dac3c494675060e7c71e6cf6e2d729..176893911858cfc1f0cd3b2001271d525f851af4 100755 (executable)
@@ -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 */
       }