From: Kern Sibbald Date: Mon, 11 Jul 2016 08:43:50 +0000 (+0200) Subject: Ensure that zero JobMedias are written for labelling X-Git-Tag: Release-7.4.4~6 X-Git-Url: https://git.sur5r.net/?p=bacula%2Fbacula;a=commitdiff_plain;h=4da1620a86e6e9f96bca52aac0d2825c25df40a1 Ensure that zero JobMedias are written for labelling Conflicts: bacula/src/stored/askdir.c --- diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index d60ae101a7..af0da08ca1 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -520,17 +520,17 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero) JOBMEDIA_ITEM *item; bool ok = true;; - if (!dcr->WroteVol) { + if (!zero && !dcr->WroteVol) { return true; } - if (dcr->VolLastIndex == 0) { + if (!zero && dcr->VolLastIndex == 0) { Dmsg7(dbglvl, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n", dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId, dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock); return true; /* nothing written to the Volume */ } - if (dcr->StartFile == dcr->EndFile && dcr->EndBlock < dcr->StartBlock) { - Dmsg7(0/*dbglvl*/, "PROBLEM Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n", + if (!zero && dcr->StartFile == dcr->EndFile && dcr->EndBlock < dcr->StartBlock) { + Dmsg7(dbglvl, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n", dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId, dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock); return true; diff --git a/bacula/src/stored/block_util.c b/bacula/src/stored/block_util.c index cedcc8d335..3d67de9208 100644 --- a/bacula/src/stored/block_util.c +++ b/bacula/src/stored/block_util.c @@ -621,8 +621,8 @@ bool check_for_newvol_or_newfile(DCR *dcr) Dmsg0(100, "Canceled\n"); return false; } - /* Create a jobmedia record for this job */ - if (!dir_create_jobmedia_record(dcr)) { + /* If we wrote on Volume create a last jobmedia record for this job */ + if (dcr->VolFirstIndex && !dir_create_jobmedia_record(dcr)) { dcr->dev->dev_errno = EIO; Jmsg2(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"), dcr->getVolCatName(), jcr->Job);