]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add code to reservation VOLRES subroutines to try to ensure
authorKern Sibbald <kern@sibbald.com>
Fri, 16 Sep 2005 10:43:35 +0000 (10:43 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 16 Sep 2005 10:43:35 +0000 (10:43 +0000)
  we don't end up with two Volumes on the same drive.
- Simplify the mutex code in VOLRES a bit to reduce the chance
  of error.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2392 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/kes-1.37
bacula/src/stored/reserve.c
bacula/src/version.h

index e7763973710cd13fb9176700f8badcfdce8eb6fe..3a6e5e086c2106cb0d09bf5b9ee2a01d5553c79f 100644 (file)
@@ -10,6 +10,30 @@ Version 1.37                Kern (see below)
 Final items for 1.37 before release:
 1. Fix bugs
 - Look at fixing restore status stats in SD.
+- Check if ANSI tape labeling works with drive in
+  read-only mode.
+   > > btape: label.c:299 write_volume_label()
+   > > btape: label.c:302 Label type=0
+   > > btape: dev.c:648 rewind_dev fd=3 "VTS0" (/dev/tape0)
+   > > btape: label.c:530 Start create_volume_label()
+   > >
+   > > Volume Label:
+   > > Id                : Bacula 1.0 immortal
+   > > VerNo             : 11
+   > > VolName           : 450340
+   > > PrevVolName       :
+   > > VolFile           : 0
+   > > LabelType         : PRE_LABEL
+   > > LabelSize         : 0
+   > > PoolName          : Default
+   > > MediaType         : VTS
+   > > PoolType          : Backup
+   > > HostName          : sysrmr.eia.doe.gov
+   > > btape: ansi_label.c:282 Write ANSI label type=2
+   > > 15-Sep 13:12 btape: btape Fatal error: ansi_label.c:303 Could not
+   > > write ANSI VOL1
+   > > label. ERR=Bad file descriptor
+
 - Check "update slots=7 scan storage=DLT drive=0" with    
   non-bacula tape in the drive.
 
index be0100f6e428625dff71420a576100a8eafa5cad..b5f75ff5b446db79f96698ff670adecdee845b9f 100644 (file)
@@ -4,6 +4,11 @@
 General:
 
 Changes to 1.37.39:
+16Sep05
+- Add code to reservation VOLRES subroutines to try to ensure
+  we don't end up with two Volumes on the same drive.
+- Simplify the mutex code in VOLRES a bit to reduce the chance
+  of error.
 15Sep05
 - Apply Nicolas' dvd-freespace.in patch.
 - Make sure SQL table names are not translated.
index 4543c3a65597b179a7dda50acd9629f8835f5983..d3b1940d71f63c3e51c0a633394d9c07117ce874 100644 (file)
@@ -116,22 +116,34 @@ VOLRES *new_volume(DCR *dcr, const char *VolumeName)
    VOLRES *vol, *nvol;
 
    Dmsg1(400, "new_volume %s\n", VolumeName);
+   P(vol_list_lock);
+   if (dcr->dev) {
+      foreach_dlist(vol, vol_list) {
+         if (vol && vol->dev == dcr->dev) {
+            vol_list->remove(vol);
+            if (vol->vol_name) {
+               free(vol->vol_name);
+            }
+            free(vol);
+            break;
+         }
+      }
+   }
    vol = (VOLRES *)malloc(sizeof(VOLRES));
    memset(vol, 0, sizeof(VOLRES));
    vol->vol_name = bstrdup(VolumeName);
    vol->dev = dcr->dev;
    vol->dcr = dcr;
-   P(vol_list_lock);
    nvol = (VOLRES *)vol_list->binary_insert(vol, my_compare);
-   V(vol_list_lock);
    if (nvol != vol) {
       free(vol->vol_name);
       free(vol);
+      vol = NULL;
       if (dcr->dev) {
          nvol->dev = dcr->dev;
       }
-      return NULL;
    }
+   V(vol_list_lock);
    return vol;
 }
 
@@ -144,11 +156,11 @@ VOLRES *new_volume(DCR *dcr, const char *VolumeName)
 VOLRES *find_volume(const char *VolumeName)
 {
    VOLRES vol, *fvol;
-   vol.vol_name = bstrdup(VolumeName);
    P(vol_list_lock);
+   vol.vol_name = bstrdup(VolumeName);
    fvol = (VOLRES *)vol_list->binary_search(&vol, my_compare);
-   V(vol_list_lock);
    free(vol.vol_name);
+   V(vol_list_lock);
    return fvol;
 }
 
@@ -162,13 +174,13 @@ bool free_volume(DEVICE *dev)
 {
    VOLRES vol, *fvol;
 
+  P(vol_list_lock);
    if (dev->VolHdr.VolumeName[0] == 0) {
       /*
        * Our device has no VolumeName listed, but
        *  search the list for any Volume attached to
        *  this device and remove it.
        */
-      P(vol_list_lock);
       foreach_dlist(fvol, vol_list) {
          if (fvol && fvol->dev == dev) {
             vol_list->remove(fvol);
@@ -179,21 +191,20 @@ bool free_volume(DEVICE *dev)
             break;
          }
       }
-      V(vol_list_lock);
-      return fvol != NULL;
+      goto bail_out;
    }
    Dmsg1(400, "free_volume %s\n", dev->VolHdr.VolumeName);
    vol.vol_name = bstrdup(dev->VolHdr.VolumeName);
-   P(vol_list_lock);
    fvol = (VOLRES *)vol_list->binary_search(&vol, my_compare);
    if (fvol) {
       vol_list->remove(fvol);
       free(fvol->vol_name);
       free(fvol);
    }
-   V(vol_list_lock);
    free(vol.vol_name);
    dev->VolHdr.VolumeName[0] = 0;
+bail_out:
+   V(vol_list_lock);
    return fvol != NULL;
 }
 
index dadaa2609299b0de7929471a96de0587b8934fda..1c35c38b197e64870396cc684de2fc9d6a668845 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.37.39"
-#define BDATE   "15 September 2005"
-#define LSMDATE "15Sep05"
+#define BDATE   "16 September 2005"
+#define LSMDATE "16Sep05"
 
 /* Debug flags */
 #undef  DEBUG