]> git.sur5r.net Git - bacula/bacula/commitdiff
Another tweak for bug 801
authorKern Sibbald <kern@sibbald.com>
Wed, 4 Apr 2007 18:34:15 +0000 (18:34 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 4 Apr 2007 18:34:15 +0000 (18:34 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4509 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/reserve.c

index 4b459993f94154b849bed3b79a57604b52d2a7cb..79d299dd2912ee21bfc652ab55e383dfb33f03f3 100644 (file)
@@ -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)) {