From 98f5d20b0cb18e12c3660de121b2aecd9ff8b821 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 19 Nov 2017 11:45:14 +0100 Subject: [PATCH] Try to fix bug #2349 multiple recycle messages --- bacula/src/dird/next_vol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bacula/src/dird/next_vol.c b/bacula/src/dird/next_vol.c index 40688a85c3..0b6a48dadc 100644 --- a/bacula/src/dird/next_vol.c +++ b/bacula/src/dird/next_vol.c @@ -271,14 +271,14 @@ bool has_volume_expired(JCR *jcr, MEDIA_DBR *mr) expired = true; /* Now see if Volume should only be used once */ - } else if (mr->VolBytes > 0 && jcr->pool->use_volume_once) { + } else if (mr->VolBytes > 1000 && jcr->pool->use_volume_once) { Jmsg(jcr, M_INFO, 0, _("Volume used once. " "Marking Volume \"%s\" as Used.\n"), mr->VolumeName); bstrncpy(mr->VolStatus, "Used", sizeof(mr->VolStatus)); expired = true; /* Now see if Max Jobs written to volume */ - } else if (mr->MaxVolJobs > 0 && mr->MaxVolJobs <= mr->VolJobs) { + } else if (mr->MaxVolJobs > 1000 && mr->MaxVolJobs <= mr->VolJobs) { Jmsg(jcr, M_INFO, 0, _("Max Volume jobs=%s exceeded. " "Marking Volume \"%s\" as Used.\n"), edit_uint64_with_commas(mr->MaxVolJobs, ed1), mr->VolumeName); @@ -336,6 +336,9 @@ void check_if_volume_valid_or_recyclable(JCR *jcr, MEDIA_DBR *mr, const char **r /* Check if a duration or limit has expired */ if (has_volume_expired(jcr, mr)) { *reason = _("volume has expired"); + if (!mr->Recycle) { /* cannot recycle */ + return; + } /* Keep going because we may be able to recycle volume */ } -- 2.39.2