|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
This patch should fix the logic error in checking for the MaxWaitTime of
|
|
Andreas Thienemann |
758f5d |
a job in src/dird/job.c. It fixes bug #802.
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
Apply it to Bacula version 2.0.3 with:
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
cd <bacula-source>
|
|
Andreas Thienemann |
758f5d |
patch -p0 <2.0.3-maxwaittime.patch
|
|
Andreas Thienemann |
758f5d |
make
|
|
Andreas Thienemann |
758f5d |
...
|
|
Andreas Thienemann |
758f5d |
make install
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
Index: src/dird/job.c
|
|
Andreas Thienemann |
758f5d |
===================================================================
|
|
Andreas Thienemann |
758f5d |
--- src/dird/job.c (revision 4349)
|
|
Andreas Thienemann |
758f5d |
+++ src/dird/job.c (working copy)
|
|
Andreas Thienemann |
758f5d |
@@ -481,7 +481,6 @@
|
|
Andreas Thienemann |
758f5d |
static bool job_check_maxwaittime(JCR *control_jcr, JCR *jcr)
|
|
Andreas Thienemann |
758f5d |
{
|
|
Andreas Thienemann |
758f5d |
bool cancel = false;
|
|
Andreas Thienemann |
758f5d |
- bool ok_to_cancel = false;
|
|
Andreas Thienemann |
758f5d |
JOB *job = jcr->job;
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
if (job_canceled(jcr)) {
|
|
Andreas Thienemann |
758f5d |
@@ -493,69 +492,18 @@
|
|
Andreas Thienemann |
758f5d |
}
|
|
Andreas Thienemann |
758f5d |
if (jcr->JobLevel == L_FULL && job->FullMaxWaitTime != 0 &&
|
|
Andreas Thienemann |
758f5d |
(watchdog_time - jcr->start_time) >= job->FullMaxWaitTime) {
|
|
Andreas Thienemann |
758f5d |
- ok_to_cancel = true;
|
|
Andreas Thienemann |
758f5d |
+ cancel = true;
|
|
Andreas Thienemann |
758f5d |
} else if (jcr->JobLevel == L_DIFFERENTIAL && job->DiffMaxWaitTime != 0 &&
|
|
Andreas Thienemann |
758f5d |
(watchdog_time - jcr->start_time) >= job->DiffMaxWaitTime) {
|
|
Andreas Thienemann |
758f5d |
- ok_to_cancel = true;
|
|
Andreas Thienemann |
758f5d |
+ cancel = true;
|
|
Andreas Thienemann |
758f5d |
} else if (jcr->JobLevel == L_INCREMENTAL && job->IncMaxWaitTime != 0 &&
|
|
Andreas Thienemann |
758f5d |
(watchdog_time - jcr->start_time) >= job->IncMaxWaitTime) {
|
|
Andreas Thienemann |
758f5d |
- ok_to_cancel = true;
|
|
Andreas Thienemann |
758f5d |
+ cancel = true;
|
|
Andreas Thienemann |
758f5d |
} else if (job->MaxWaitTime != 0 &&
|
|
Andreas Thienemann |
758f5d |
(watchdog_time - jcr->start_time) >= job->MaxWaitTime) {
|
|
Andreas Thienemann |
758f5d |
- ok_to_cancel = true;
|
|
Andreas Thienemann |
758f5d |
- }
|
|
Andreas Thienemann |
758f5d |
- if (!ok_to_cancel) {
|
|
Andreas Thienemann |
758f5d |
- return false;
|
|
Andreas Thienemann |
758f5d |
- }
|
|
Andreas Thienemann |
758f5d |
-
|
|
Andreas Thienemann |
758f5d |
-/*
|
|
Andreas Thienemann |
758f5d |
- * I don't see the need for all this -- kes 17Dec06
|
|
Andreas Thienemann |
758f5d |
- */
|
|
Andreas Thienemann |
758f5d |
-#ifdef xxx
|
|
Andreas Thienemann |
758f5d |
- Dmsg3(800, "Job %d (%s): MaxWaitTime of %d seconds exceeded, "
|
|
Andreas Thienemann |
758f5d |
- "checking status\n",
|
|
Andreas Thienemann |
758f5d |
- jcr->JobId, jcr->Job, job->MaxWaitTime);
|
|
Andreas Thienemann |
758f5d |
- switch (jcr->JobStatus) {
|
|
Andreas Thienemann |
758f5d |
- case JS_Created:
|
|
Andreas Thienemann |
758f5d |
- case JS_Blocked:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitFD:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitSD:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitStoreRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitClientRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitJobRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitPriority:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitMaxJobs:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitStartTime:
|
|
Andreas Thienemann |
758f5d |
cancel = true;
|
|
Andreas Thienemann |
758f5d |
- Dmsg0(200, "JCR blocked in #1\n");
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- case JS_Running:
|
|
Andreas Thienemann |
758f5d |
- Dmsg0(800, "JCR running, checking SD status\n");
|
|
Andreas Thienemann |
758f5d |
- switch (jcr->SDJobStatus) {
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitMount:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitMedia:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitFD:
|
|
Andreas Thienemann |
758f5d |
- cancel = true;
|
|
Andreas Thienemann |
758f5d |
- Dmsg0(800, "JCR blocked in #2\n");
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- default:
|
|
Andreas Thienemann |
758f5d |
- Dmsg0(800, "JCR not blocked in #2\n");
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- }
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- case JS_Terminated:
|
|
Andreas Thienemann |
758f5d |
- case JS_ErrorTerminated:
|
|
Andreas Thienemann |
758f5d |
- case JS_Canceled:
|
|
Andreas Thienemann |
758f5d |
- case JS_FatalError:
|
|
Andreas Thienemann |
758f5d |
- Dmsg0(800, "JCR already dead in #3\n");
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- default:
|
|
Andreas Thienemann |
758f5d |
- Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
|
|
Andreas Thienemann |
758f5d |
- jcr->JobStatus);
|
|
Andreas Thienemann |
758f5d |
}
|
|
Andreas Thienemann |
758f5d |
- Dmsg3(800, "MaxWaitTime result: %scancel JCR %p (%s)\n",
|
|
Andreas Thienemann |
758f5d |
- cancel ? "" : "do not ", jcr, jcr->Job);
|
|
Andreas Thienemann |
758f5d |
-#endif
|
|
Andreas Thienemann |
758f5d |
+
|
|
Andreas Thienemann |
758f5d |
return cancel;
|
|
Andreas Thienemann |
758f5d |
}
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
@@ -574,36 +522,6 @@
|
|
Andreas Thienemann |
758f5d |
return false;
|
|
Andreas Thienemann |
758f5d |
}
|
|
Andreas Thienemann |
758f5d |
|
|
Andreas Thienemann |
758f5d |
-#ifdef xxx
|
|
Andreas Thienemann |
758f5d |
- switch (jcr->JobStatus) {
|
|
Andreas Thienemann |
758f5d |
- case JS_Created:
|
|
Andreas Thienemann |
758f5d |
- case JS_Running:
|
|
Andreas Thienemann |
758f5d |
- case JS_Blocked:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitFD:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitSD:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitStoreRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitClientRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitJobRes:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitPriority:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitMaxJobs:
|
|
Andreas Thienemann |
758f5d |
- case JS_WaitStartTime:
|
|
Andreas Thienemann |
758f5d |
- case JS_Differences:
|
|
Andreas Thienemann |
758f5d |
- cancel = true;
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- case JS_Terminated:
|
|
Andreas Thienemann |
758f5d |
- case JS_ErrorTerminated:
|
|
Andreas Thienemann |
758f5d |
- case JS_Canceled:
|
|
Andreas Thienemann |
758f5d |
- case JS_FatalError:
|
|
Andreas Thienemann |
758f5d |
- cancel = false;
|
|
Andreas Thienemann |
758f5d |
- break;
|
|
Andreas Thienemann |
758f5d |
- default:
|
|
Andreas Thienemann |
758f5d |
- Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
|
|
Andreas Thienemann |
758f5d |
- jcr->JobStatus);
|
|
Andreas Thienemann |
758f5d |
- }
|
|
Andreas Thienemann |
758f5d |
-
|
|
Andreas Thienemann |
758f5d |
- Dmsg3(200, "MaxRunTime result: %scancel JCR %p (%s)\n",
|
|
Andreas Thienemann |
758f5d |
- cancel ? "" : "do not ", jcr, jcr->Job);
|
|
Andreas Thienemann |
758f5d |
-#endif
|
|
Andreas Thienemann |
758f5d |
return true;
|
|
Andreas Thienemann |
758f5d |
}
|
|
Andreas Thienemann |
758f5d |
|