From e62fc0c4690a5729c4e663688458c40c61e73910 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 7 Jul 2008 06:51:11 +0000 Subject: [PATCH] Clear in-use bit on vol when unused while swapping git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7327 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/mount.c | 1 + bacula/src/stored/reserve.c | 21 +++++---------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 5cd93cf4dd..c7f5eda63a 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -522,6 +522,7 @@ void DCR::do_swapping(bool is_writing) } if (dev->vol) { dev->vol->clear_swapping(); + Dmsg1(100, "=== set in_use vol=%s\n", dev->vol->vol_name); dev->vol->set_in_use(); dev->VolHdr.VolumeName[0] = 0; /* don't yet have right Volume */ } diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 197dbcf254..3c1fe55b69 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -335,8 +335,6 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) if (strcmp(vol->vol_name, VolumeName) == 0) { Dmsg2(dbglvl, "=== set reserved vol=%s dev=%s\n", VolumeName, vol->dev->print_name()); - vol->set_in_use(); /* retake vol if released previously */ - dcr->reserved_volume = true; /* reserved volume */ goto get_out; /* Volume already on this device */ } else { /* Don't release a volume if it was reserved by someone other than us */ @@ -539,23 +537,12 @@ bool volume_unused(DCR *dcr) } if (dev->vol->is_swapping()) { Dmsg1(dbglvl, "vol_unused: vol being swapped on %s\n", dev->print_name()); - debug_list_volumes("swapping vol cannot unreserve_volume"); + Dmsg1(dbglvl, "=== clear in_use vol=%s\n", dev->vol->vol_name); + dev->vol->clear_in_use(); + debug_list_volumes("swapping vol cannot free_volume"); 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 -#ifdef xxx - if (dev->num_writers > 0 || dev->num_reserved() > 0) { - ASSERT(0); - } -#endif - /* * If this is a tape, we do not free the volume, rather we wait * until the autoloader unloads it, or until another tape is @@ -564,6 +551,7 @@ bool volume_unused(DCR *dcr) */ Dmsg4(dbglvl, "=== set not reserved vol=%s num_writers=%d dev_reserved=%d dev=%s\n", dev->vol->vol_name, dev->num_writers, dev->num_reserved(), dev->print_name()); + Dmsg1(dbglvl, "=== clear in_use vol=%s\n", dev->vol->vol_name); dev->vol->clear_in_use(); if (dev->is_tape() || dev->is_autochanger()) { return true; @@ -591,6 +579,7 @@ bool free_volume(DEVICE *dev) vol = dev->vol; /* Don't free a volume while it is being swapped */ if (!vol->is_swapping()) { + Dmsg1(dbglvl, "=== clear in_use vol=%s\n", dev->vol->vol_name); dev->vol = NULL; vol_list->remove(vol); Dmsg2(dbglvl, "=== remove volume %s dev=%s\n", vol->vol_name, dev->print_name()); -- 2.39.5