From: Kern Sibbald Date: Sun, 6 Jan 2008 22:12:52 +0000 (+0000) Subject: volume_unused() tweaks X-Git-Tag: Release-3.0.0~2003 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=846c3118290124055a8b999748ea710af7836f7e;p=bacula%2Fbacula volume_unused() tweaks git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6250 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 198bb858cd..a0dcf4ced2 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -80,7 +80,6 @@ bool acquire_device_for_read(DCR *dcr) edit_int64(jcr->JobId, ed1)); goto get_out; } - volume_unused(dcr); /* release any current volume */ jcr->CurReadVolume++; for (i=1; iCurReadVolume; i++) { vol = vol->next; @@ -507,6 +506,7 @@ bool release_device(DCR *dcr) dev->clear_read(); /* clear read bit */ Dmsg0(100, "dir_update_vol_info. Release0\n"); dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ + volume_unused(dcr); } else if (dev->num_writers > 0) { /* @@ -527,6 +527,7 @@ bool release_device(DCR *dcr) if (!dev->num_writers && dev->can_write() && dev->block_num > 0) { dev->weof(1); write_ansi_ibm_labels(dcr, ANSI_EOF_LABEL, dev->VolHdr.VolumeName); + volume_unused(dcr); } if (!dev->at_weot()) { dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */ diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index e9557e301d..d0e3b7b43b 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 if no one is using - * the volume, mark it unused. + * Remove any reservation from a drive and tell the system + * that the volume is unused at least by us. */ void unreserve_device(DCR *dcr) { @@ -510,6 +510,11 @@ bool volume_unused(DCR *dcr) #endif Dmsg2(dbglvl, "mark released. num_writers=%d reserved=%d\n", dev->num_writers, dev->reserved_device); +#ifdef xxx + if (dev->num_writers > 0 || dev->reserved_device > 0) { + ASSERT(0); + } +#endif /* * If this is a tape, we do not free the volume, rather we wait @@ -1161,7 +1166,7 @@ static int reserve_device(RCTX &rctx) if (dcr->volume_in_use && !rctx.PreferMountedVols) { rctx.PreferMountedVols = true; if (dcr->VolumeName[0]) { - volume_unused(dcr); + // volume_unused(dcr); } goto bail_out; } @@ -1178,7 +1183,7 @@ static int reserve_device(RCTX &rctx) */ if (dcr->dev->num_writers != 0) { if (dcr->VolumeName[0]) { - volume_unused(dcr); + // volume_unused(dcr); } goto bail_out; } diff --git a/bacula/src/version.h b/bacula/src/version.h index 6ad992a29e..e127cca19d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.8" -#define BDATE "02 January 2008" -#define LSMDATE "02Jan08" +#define BDATE "06 January 2008" +#define LSMDATE "06Jan08" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */