]> 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)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:49:32 +0000 (16:49 +0200)
bacula/src/dird/job.c
bacula/src/stored/dircmd.c

index 80e8744c87128a361028ee995253206ef86e2c96..36308e8f38557fa9a089bbb409bad5fb5ef2a068 100644 (file)
@@ -452,7 +452,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);
          }
@@ -503,6 +508,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);
@@ -765,11 +779,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 918414cef1d3b903d8c8b9872697ae398ce8f3e1..5ee4d6756f3a7c6f0982d188fabc8799c5d89621 100644 (file)
@@ -326,7 +326,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);
          }