From: Michal Rakowski Date: Tue, 4 May 2021 20:38:55 +0000 (+0200) Subject: Fix org#2610 About incorrect stopping of running job X-Git-Tag: Release-11.3.2~545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94cc03db2e7a0ad2384d7c5c6be015736992a5a8;p=thirdparty%2Fbacula.git Fix org#2610 About incorrect stopping of running job Extended 'is_job_canceled()' helper to check for the Incomplete state. This way, handling job which was either stopped or cancelled is more elegant (e.g. it is now possible to stop job which was waiting on mounting volume during backup - it was not possilbe before). --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 099746789..3a8589787 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -107,6 +107,7 @@ enum { #define job_canceled(jcr) \ (jcr->JobStatus == JS_Canceled || \ + jcr->JobStatus == JS_Incomplete || \ jcr->JobStatus == JS_ErrorTerminated || \ jcr->JobStatus == JS_FatalError \ ) diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index e1a2dc2f4..165dbfbf1 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -867,6 +867,15 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr) continue; } + if (stat == W_WAKE) { + /* Job could be marked to stopped, need to break */ + Mmsg0(dev->errmsg, _("Job was stopped by the user.\n")); + Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg); + Dmsg1(dbglvl, "Job marked to be stopped. Gave up waiting on device %s\n", dev->print_name()); + dev->poll = false; + return false; + } + if (stat == W_TIMEOUT) { if (!double_dev_wait_time(dev)) { Mmsg(dev->errmsg, _("Max time exceeded waiting to mount Storage Device %s for Job %s\n"),