From 5dae80287eaf302528ba373b011a2c833670d34c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 6 Jan 2008 20:50:03 +0000 Subject: [PATCH] More reservations tweaks git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6249 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dircmd.c | 2 +- bacula/src/stored/reserve.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 57e960f94c..1529367f08 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2007 Free Software Foundation Europe e.V. + Copyright (C) 2001-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index e65c6bb984..e9557e301d 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -456,8 +456,8 @@ VOLRES *find_volume(DCR *dcr) } /* - * Remove any reservation from a drive and tell the system - * that the volume is unused at least by us. + * Remove any reservation from a drive and if no one is using + * the volume, mark it unused. */ void unreserve_device(DCR *dcr) { @@ -475,8 +475,10 @@ void unreserve_device(DCR *dcr) Jmsg1(dcr->jcr, M_ERROR, 0, _("Hey! num_writers=%d!!!!\n"), dev->num_writers); dev->num_writers = 0; } + if (dev->reserved_device == 0 && dev->num_writers == 0) { + volume_unused(dcr); + } } - volume_unused(dcr); } /* @@ -499,11 +501,15 @@ bool volume_unused(DCR *dcr) return false; } +#ifdef xxx if (dev->is_busy()) { Dmsg1(dbglvl, "vol_unused: busy on %s\n", dev->print_name()); debug_list_volumes("dev busy cannot unreserve_volume"); return false; } +#endif + Dmsg2(dbglvl, "mark released. num_writers=%d reserved=%d\n", + dev->num_writers, dev->reserved_device); /* * If this is a tape, we do not free the volume, rather we wait -- 2.39.5