From 454ddd8386e50f24aa21d84ce0ce4d715d4b0370 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 27 Oct 2008 18:38:55 +0000 Subject: [PATCH] ebl Fix #1173 where prune_volume() returns a volume from the scratch. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7916 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/autoprune.c | 7 ------ bacula/src/dird/next_vol.c | 44 +++++++++++++++++++------------------ bacula/technotes-2.5 | 2 ++ 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/bacula/src/dird/autoprune.c b/bacula/src/dird/autoprune.c index 1eaaeb10d4..a80386cbfd 100644 --- a/bacula/src/dird/autoprune.c +++ b/bacula/src/dird/autoprune.c @@ -204,13 +204,6 @@ bool prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr) memcpy(mr, &lmr, sizeof(lmr)); break; /* got a volume */ } - /* - * We purged something but did not get a volume in the current pool. - * It must be a scratch volume, so try to get it. - */ - if (ok && get_scratch_volume(jcr, InChanger, mr)) { - break; /* got a volume */ - } ok = false; /* clear OK, in case we fall out */ } else { Dmsg2(050, "Nothing pruned MediaId=%d Volume=%s\n", (int)lmr.MediaId, lmr.VolumeName); diff --git a/bacula/src/dird/next_vol.c b/bacula/src/dird/next_vol.c index a86342bbfc..b070b7777c 100644 --- a/bacula/src/dird/next_vol.c +++ b/bacula/src/dird/next_vol.c @@ -94,28 +94,30 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, int index, */ if (prune) { Dmsg0(150, "Call prune_volumes\n"); - prune_volumes(jcr, InChanger, mr); + ok = prune_volumes(jcr, InChanger, mr); } - ok = recycle_oldest_purged_volume(jcr, InChanger, mr); - if (!ok && create) { - Dmsg4(050, "after prune volumes_vol ok=%d index=%d InChanger=%d Vstat=%s\n", - ok, index, InChanger, mr->VolStatus); - /* - * 5. Try pulling a volume from the Scratch pool - */ - ok = get_scratch_volume(jcr, InChanger, mr); - } - /* - * If we are using an Autochanger and have not found - * a volume, retry looking for any volume. - */ - if (InChanger) { - InChanger = false; - if (!ok) { - continue; /* retry again accepting any volume */ - } - } - } + if (!ok) { + ok = recycle_oldest_purged_volume(jcr, InChanger, mr); + if (!ok && create) { + Dmsg4(050, "after prune volumes_vol ok=%d index=%d InChanger=%d Vstat=%s\n", + ok, index, InChanger, mr->VolStatus); + /* + * 5. Try pulling a volume from the Scratch pool + */ + ok = get_scratch_volume(jcr, InChanger, mr); + Dmsg4(050, "after get scratch volume ok=%d index=%d InChanger=%d Vstat=%s\n", + ok, index, InChanger, mr->VolStatus); + } + /* + * If we are using an Autochanger and have not found + * a volume, retry looking for any volume. + */ + if (!ok && InChanger) { + InChanger = false; + continue; /* retry again accepting any volume */ + } + } + } } diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 070f53538a..7f16dbf919 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,8 @@ filepattern (restore with regex in bsr) mixed priorities General: +27Oct08 +ebl Fix #1173 where prune_volume() returns a volume from the scratch. 25Oct08 kes Remove jobq.c constraint that read and write SD must be different. This may lead to more deadlocks in the SD, -- 2.39.5