]> git.sur5r.net Git - bacula/bacula/commitdiff
Make dup jobs regress test work
authorKern Sibbald <kern@sibbald.com>
Tue, 16 Feb 2010 12:59:47 +0000 (13:59 +0100)
committerKern Sibbald <kern@sibbald.com>
Tue, 16 Feb 2010 13:05:05 +0000 (14:05 +0100)
bacula/src/dird/job.c
bacula/src/stored/dircmd.c

index efd663ba4a58a1fe60eccf64ecddbdccb5cac700..857ac31b5969af5153bf687133a15d50b0738ff6 100644 (file)
@@ -449,7 +449,12 @@ bool cancel_job(UAContext *ua, JCR *jcr)
          sd->signal(BNET_TERMINATE);
          sd->close();
          ua->jcr->store_bsock = NULL;
+         jcr->store_bsock->set_timed_out();
          jcr->store_bsock->set_terminated();
+         if (jcr->SD_msg_chan) {
+            Dmsg2(400, "kill jobid=%d use=%d\n", (int)jcr->JobId, jcr->use_count());
+            pthread_kill(jcr->SD_msg_chan, TIMEOUT_SIGNAL);
+         }
          if (jcr->my_thread_id) {
             pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
          }
@@ -500,6 +505,15 @@ void cancel_storage_daemon_job(JCR *jcr)
       sd->close();
       ua->jcr->store_bsock = NULL;
       jcr->sd_canceled = true;
+      jcr->store_bsock->set_timed_out();
+      jcr->store_bsock->set_terminated();
+      if (jcr->SD_msg_chan) {
+         Dmsg2(400, "kill jobid=%d use=%d\n", (int)jcr->JobId, jcr->use_count());
+         pthread_kill(jcr->SD_msg_chan, TIMEOUT_SIGNAL);
+      }
+      if (jcr->my_thread_id) {
+         pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
+      }
    }
 bail_out:
    free_jcr(control_jcr);
@@ -762,11 +776,9 @@ bool allow_duplicate_job(JCR *jcr)
             UAContext *ua = new_ua_context(jcr);
             Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%d.\n"), djcr->JobId);
             cancel_job(ua, djcr);
+            bmicrosleep(0, 500000);
+            cancel_job(ua, djcr);
             free_ua_context(ua);
-            if (djcr->my_thread_id) {
-               pthread_kill(djcr->my_thread_id, TIMEOUT_SIGNAL);
-               Dmsg1(800, "Send kill to jid=%d\n", djcr->JobId);
-            }
             Dmsg2(800, "Cancel dup %p JobId=%d\n", djcr, djcr->JobId);
          } else {
             /* Zap current job */
index a39f680806b7f51935ee7f639ba9258903865750..ad0a0dece6f61ebee0b26d1fb92581792787e15d 100644 (file)
@@ -317,7 +317,6 @@ static bool cancel_cmd(JCR *cjcr)
             Dmsg2(800, "Term bsock jid=%d %p\n", jcr->JobId, jcr);
          } else {
             /* Still waiting for FD to connect, release it */
-            bmicrosleep(0, 50000);
             pthread_cond_signal(&jcr->job_start_wait); /* wake waiting job */
             Dmsg2(800, "Signal FD connect jid=%d %p\n", jcr->JobId, jcr);
          }