Skip to content

Commit

Permalink
stored: don't touch devices that were not acquired
Browse files Browse the repository at this point in the history
when one of acquire_device_for_read() or
acquire_device_for_append() in do_mac_run()
returned false, the code still touched the
devices eventually failing another job that
had the device currently acquired.
This patch makes sure do_mac_run() does not
touch any device it couldn't aquire.
  • Loading branch information
arogge committed Mar 19, 2019
1 parent a3affbe commit 8eba607
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/stored/mac.cc
Expand Up @@ -490,6 +490,7 @@ bool DoMacRun(JobControlRecord* jcr)
char ec1[50];
const char* Type;
bool ok = true;
bool acquire_fail = false;
BareosSocket* dir = jcr->dir_bsock;
Device* dev = jcr->dcr->dev;

Expand Down Expand Up @@ -543,6 +544,7 @@ bool DoMacRun(JobControlRecord* jcr)
*/
if (!AcquireDeviceForRead(jcr->read_dcr)) {
ok = false;
acquire_fail = true;
goto bail_out;
}

Expand Down Expand Up @@ -661,6 +663,7 @@ bool DoMacRun(JobControlRecord* jcr)
if (!AcquireDeviceForRead(jcr->read_dcr) ||
!AcquireDeviceForAppend(jcr->dcr)) {
ok = false;
acquire_fail = true;
goto bail_out;
}

Expand Down Expand Up @@ -699,7 +702,7 @@ bool DoMacRun(JobControlRecord* jcr)
bail_out:
if (!ok) { jcr->setJobStatus(JS_ErrorTerminated); }

if (!jcr->remote_replicate && jcr->dcr) {
if (!acquire_fail && !jcr->remote_replicate && jcr->dcr) {
/*
* Don't use time_t for job_elapsed as time_t can be 32 or 64 bits,
* and the subsequent Jmsg() editing will break
Expand Down

0 comments on commit 8eba607

Please sign in to comment.