From: Eric Bollengier Date: Mon, 12 Mar 2018 10:11:42 +0000 (+0100) Subject: Do not increment the device num_writers if the call to dir_update_volume_info() fails X-Git-Tag: Release-9.2.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3d5c225894288f1241b1bf9d36691f5ba10b5e0;p=thirdparty%2Fbacula.git Do not increment the device num_writers if the call to dir_update_volume_info() fails The function dir_update_volume_info() can return false, and we leave the function with num_writers that is not correct, and it blocks further restore jobs. --- diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 016f76b65..e68a57cf8 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -446,10 +446,17 @@ DCR *acquire_device_for_append(DCR *dcr) jcr->NumWriteVolumes = 1; } dev->VolCatInfo.VolCatJobs++; /* increment number of jobs on vol */ + + ok = dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ + + if (!ok) { /* We cannot use this volume/device */ + dev->num_writers--; /* on fail update_volume do not update num_writers */ + /* TODO: See if we revert the NumWriteVolumes as well */ + } + Dmsg4(100, "=== nwriters=%d nres=%d vcatjob=%d dev=%s\n", dev->num_writers, dev->num_reserved(), dev->VolCatInfo.VolCatJobs, dev->print_name()); - ok = dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ get_out: /* Don't plugin close here, we might have multiple writers */