From 603d7ac671f8f5ec1f2f0cf0782ca23664b1393d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 4 Apr 2007 18:34:15 +0000 Subject: [PATCH] Another tweak for bug 801 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4509 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/reserve.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 4b459993f9..79d299dd29 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -148,7 +148,11 @@ again: foreach_dlist(vol, vol_list) { if (vol && vol->dev == dcr->dev) { vol_list->remove(vol); - if (vol->vol_name) { + /* + * Make sure we don't remove the current volume we are inserting + * because it was probably inserted by another job. + */ + if (vol->vol_name && strcmp(vol->vol_name, VolumeName) != 0) { Dmsg1(100, "new_vol free vol=%s\n", vol->vol_name); free(vol->vol_name); } @@ -276,8 +280,8 @@ void free_unused_volume(DCR *dcr) /* * Releease this volume, but only if we inserted it (same dcr) and * it is not attached to a device or the Volume in the device is - * different. - * I wonder if this is right, kes ... + * different. Requiring a different name for the Volume in the + * device ensures that we don't free a volume in use. */ if (vol->dcr == dcr && (vol->dev == NULL || strcmp(vol->vol_name, vol->dev->VolHdr.VolumeName) != 0)) { -- 2.39.5