]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/jobq.c
- Fix the block listing bug pointed out by Arno.
[bacula/bacula] / bacula / src / dird / jobq.c
index ccc794e92923b6862609f678f84a2ae9b37bba3e..6ec9a5de51cd4bebe807282ee03ff8d9f0fee4af 100755 (executable)
@@ -64,7 +64,7 @@ int jobq_init(jobq_t *jq, int threads, void *(*engine)(void *arg))
 
    if ((stat = pthread_attr_init(&jq->attr)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_attr_init: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_attr_init: ERR=%s\n"), be.strerror(stat));
       return stat;
    }
    if ((stat = pthread_attr_setdetachstate(&jq->attr, PTHREAD_CREATE_DETACHED)) != 0) {
@@ -73,13 +73,13 @@ int jobq_init(jobq_t *jq, int threads, void *(*engine)(void *arg))
    }
    if ((stat = pthread_mutex_init(&jq->mutex, NULL)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_mutex_init: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_mutex_init: ERR=%s\n"), be.strerror(stat));
       pthread_attr_destroy(&jq->attr);
       return stat;
    }
    if ((stat = pthread_cond_init(&jq->work, NULL)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_cond_init: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_cond_init: ERR=%s\n"), be.strerror(stat));
       pthread_mutex_destroy(&jq->mutex);
       pthread_attr_destroy(&jq->attr);
       return stat;
@@ -112,7 +112,7 @@ int jobq_destroy(jobq_t *jq)
    }
    if ((stat = pthread_mutex_lock(&jq->mutex)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_mutex_lock: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_mutex_lock: ERR=%s\n"), be.strerror(stat));
       return stat;
    }
    jq->valid = 0;                      /* prevent any more operations */
@@ -125,7 +125,7 @@ int jobq_destroy(jobq_t *jq)
       if (jq->idle_workers) {
          if ((stat = pthread_cond_broadcast(&jq->work)) != 0) {
             berrno be;
-            Jmsg1(NULL, M_ERROR, 0, "pthread_cond_broadcast: ERR=%s\n", be.strerror(stat));
+            Jmsg1(NULL, M_ERROR, 0, _("pthread_cond_broadcast: ERR=%s\n"), be.strerror(stat));
             pthread_mutex_unlock(&jq->mutex);
             return stat;
          }
@@ -133,7 +133,7 @@ int jobq_destroy(jobq_t *jq)
       while (jq->num_workers > 0) {
          if ((stat = pthread_cond_wait(&jq->work, &jq->mutex)) != 0) {
             berrno be;
-            Jmsg1(NULL, M_ERROR, 0, "pthread_cond_wait: ERR=%s\n", be.strerror(stat));
+            Jmsg1(NULL, M_ERROR, 0, _("pthread_cond_wait: ERR=%s\n"), be.strerror(stat));
             pthread_mutex_unlock(&jq->mutex);
             return stat;
          }
@@ -141,7 +141,7 @@ int jobq_destroy(jobq_t *jq)
    }
    if ((stat = pthread_mutex_unlock(&jq->mutex)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_mutex_unlock: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_mutex_unlock: ERR=%s\n"), be.strerror(stat));
       return stat;
    }
    stat  = pthread_mutex_destroy(&jq->mutex);
@@ -229,18 +229,17 @@ int jobq_add(jobq_t *jq, JCR *jcr)
       sched_pkt = (wait_pkt *)malloc(sizeof(wait_pkt));
       sched_pkt->jcr = jcr;
       sched_pkt->jq = jq;
-//    jcr->use_count--;            /* release our use of jcr */
       stat = pthread_create(&id, &jq->attr, sched_wait, (void *)sched_pkt);        
       if (stat != 0) {                /* thread not created */
          berrno be;
-         Jmsg1(jcr, M_ERROR, 0, "pthread_thread_create: ERR=%s\n", be.strerror(stat));
+         Jmsg1(jcr, M_ERROR, 0, _("pthread_thread_create: ERR=%s\n"), be.strerror(stat));
       }
       return stat;
    }
 
    if ((stat = pthread_mutex_lock(&jq->mutex)) != 0) {
       berrno be;
-      Jmsg1(jcr, M_ERROR, 0, "pthread_mutex_lock: ERR=%s\n", be.strerror(stat));
+      Jmsg1(jcr, M_ERROR, 0, _("pthread_mutex_lock: ERR=%s\n"), be.strerror(stat));
       jcr->use_count--;               /* release jcr */
       return stat;
    }
@@ -305,7 +304,7 @@ int jobq_remove(jobq_t *jq, JCR *jcr)
 
    if ((stat = pthread_mutex_lock(&jq->mutex)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_mutex_lock: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_mutex_lock: ERR=%s\n"), be.strerror(stat));
       return stat;
    }
 
@@ -351,7 +350,7 @@ static int start_server(jobq_t *jq)
       Dmsg0(2300, "Signal worker to wake up\n");
       if ((stat = pthread_cond_broadcast(&jq->work)) != 0) {
          berrno be;
-         Jmsg1(NULL, M_ERROR, 0, "pthread_cond_signal: ERR=%s\n", be.strerror(stat));
+         Jmsg1(NULL, M_ERROR, 0, _("pthread_cond_signal: ERR=%s\n"), be.strerror(stat));
          return stat;
       }
    } else if (jq->num_workers < jq->max_workers) {
@@ -360,7 +359,7 @@ static int start_server(jobq_t *jq)
       set_thread_concurrency(jq->max_workers + 1);
       if ((stat = pthread_create(&id, &jq->attr, jobq_server, (void *)jq)) != 0) {
          berrno be;
-         Jmsg1(NULL, M_ERROR, 0, "pthread_create: ERR=%s\n", be.strerror(stat));
+         Jmsg1(NULL, M_ERROR, 0, _("pthread_create: ERR=%s\n"), be.strerror(stat));
          return stat;
       }
    }
@@ -386,7 +385,7 @@ void *jobq_server(void *arg)
    Dmsg0(2300, "Start jobq_server\n");
    if ((stat = pthread_mutex_lock(&jq->mutex)) != 0) {
       berrno be;
-      Jmsg1(NULL, M_ERROR, 0, "pthread_mutex_lock: ERR=%s\n", be.strerror(stat));
+      Jmsg1(NULL, M_ERROR, 0, _("pthread_mutex_lock: ERR=%s\n"), be.strerror(stat));
       return NULL;
    }
    jq->num_workers++;
@@ -472,6 +471,7 @@ void *jobq_server(void *arg)
              jcr->JobStatus != JS_Terminated &&
              jcr->JobStatus != JS_Canceled &&
              jcr->job->RescheduleTimes > 0 &&
+             jcr->JobType == JT_BACKUP &&
              jcr->reschedule_count < jcr->job->RescheduleTimes) {
              char dt[50];
 
@@ -509,7 +509,7 @@ void *jobq_server(void *arg)
             njcr->reschedule_count = jcr->reschedule_count;
             njcr->JobLevel = jcr->JobLevel;
             njcr->JobStatus = jcr->JobStatus;
-            copy_storage(njcr, jcr);
+            copy_storage(njcr, jcr->storage);
             njcr->messages = jcr->messages;
             Dmsg0(2300, "Call to run new job\n");
             V(jq->mutex);