]> git.sur5r.net Git - bacula/bacula/commitdiff
- Update release date.
authorKern Sibbald <kern@sibbald.com>
Fri, 4 Nov 2005 09:13:07 +0000 (09:13 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 4 Nov 2005 09:13:07 +0000 (09:13 +0000)
- Tweak an authentication error message in dir.
- Fix autoloader so that mutex is set and released around
  each run_program().  There was a missing set.
- Remove an unnecessary drive release in autochanger.

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

bacula/kernstodo
bacula/src/dird/authenticate.c
bacula/src/stored/autochanger.c
bacula/src/version.h

index eb3dee5d24f1d6fdc1667306c119850e77df8e3b..cf719e7f0be1f62c1cddaf6f71bd4b83a9d8eeb7 100644 (file)
@@ -1,5 +1,5 @@
                     Kern's ToDo List
-                     29 October 2005
+                     03 November 2005
 
 Major development:      
 Project                     Developer
@@ -19,7 +19,6 @@ Document:
 
 For 1.39:
 - Look at -D_FORTIFY_SOURCE=2
-- Close STDOUT if debug_level == 0
 - Add Win32 FileSet definition somewhere
 - Look at fixing restore status stats in SD.
 - Make selection of Database used in restore correspond to
index f49b7c47c2e79b6ce9ee292817401b2c98e3680d..2b92fb2dc3b6d3cebc0efa8ff16648c0200d9957 100644 (file)
@@ -92,7 +92,7 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store)
       stop_bsock_timer(tid);
       Dmsg0(50, _("Director and Storage daemon passwords or names not the same.\n"));
       Jmsg0(jcr, M_FATAL, 0,
-            _("Unable to authenticate with Storage daemon. Possible causes:\n"
+            _("Director unable to authenticate with Storage daemon. Possible causes:\n"
             "Passwords or names not the same or\n"
             "Maximum Concurrent Jobs exceeded on the SD or\n"
             "SD networking messed up (restart daemon).\n"
index dafae5f749c206b7c7f97ef6988136a344792d73..5da5ce5c254ab25f25784ca33e510a18f6f4a171 100644 (file)
@@ -128,6 +128,7 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir)
       loaded = get_autochanger_loaded_slot(dcr);
 
       if (loaded != slot) {
+
          /* Unload anything in our drive */
          if (!unload_autochanger(dcr, loaded)) {
             goto bail_out;
@@ -138,13 +139,10 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir)
             goto bail_out;
          }
 
-         /* We are going to load a new tape, so close the device */
-         offline_or_rewind_dev(dev);
-         force_close_device(dev);
-
          /*
           * Load the desired cassette
           */
+         lock_changer(dcr);
          Dmsg1(400, "Doing changer load slot %d\n", slot);
          Jmsg(jcr, M_INFO, 0,
               _("3304 Issuing autochanger \"load slot %d, drive %d\" command.\n"),
@@ -162,9 +160,8 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir)
            be.set_errno(status);
             Jmsg(jcr, M_FATAL, 0, _("3992 Bad autochanger \"load slot %d, drive %d\": ERR=%s.\n"),
                     slot, drive, be.strerror());
-            goto bail_out;
+            rtn_stat = -1;            /* hard error */
          }
-         unlock_changer(dcr);
          Dmsg2(400, "load slot %d status=%d\n", slot, status);
       } else {
          status = 0;                  /* we got what we want */
@@ -177,12 +174,12 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir)
    } else {
       rtn_stat = 0;                   /* no changer found */
    }
+   unlock_changer(dcr);
    free_pool_memory(changer);
    return rtn_stat;
 
 bail_out:
    free_pool_memory(changer);
-   unlock_changer(dcr);
    return -1;
 
 }
@@ -190,6 +187,8 @@ bail_out:
 /*
  * Returns: -1 if error from changer command
  *          slot otherwise
+ *  Note, this is safe to do without releasing the drive
+ *   since it does not attempt load/unload a slot.
  */
 int get_autochanger_loaded_slot(DCR *dcr)
 {
@@ -207,9 +206,9 @@ int get_autochanger_loaded_slot(DCR *dcr)
    results = get_pool_memory(PM_MESSAGE);
    changer = get_pool_memory(PM_FNAME);
 
-   lock_changer(dcr);
 
    /* Find out what is loaded, zero means device is unloaded */
+   lock_changer(dcr);
    Jmsg(jcr, M_INFO, 0, _("3301 Issuing autochanger \"loaded drive %d\" command.\n"),
         drive);
    changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "loaded");
@@ -281,15 +280,17 @@ bool unload_autochanger(DCR *dcr, int loaded)
       return false;
    }
 
+   if (loaded < 0) {
+      loaded = get_autochanger_loaded_slot(dcr);
+   }
+
    /* We are going to load a new tape, so close the device */
    offline_or_rewind_dev(dev);
    force_close_device(dev);
 
-   if (loaded < 0) {
-      loaded = get_autochanger_loaded_slot(dcr);
-   }
    if (loaded > 0) {
       POOLMEM *changer = get_pool_memory(PM_FNAME);
+      lock_changer(dcr);
       Jmsg(jcr, M_INFO, 0,
            _("3307 Issuing autochanger \"unload slot %d, drive %d\" command.\n"),
            loaded, dev->drive_index);
@@ -297,9 +298,7 @@ bool unload_autochanger(DCR *dcr, int loaded)
       dcr->VolCatInfo.Slot = loaded;
       changer = edit_device_codes(dcr, changer, 
                    dcr->device->changer_command, "unload");
-      lock_changer(dcr);
       int stat = run_program(changer, timeout, NULL);
-      unlock_changer(dcr);
       dcr->VolCatInfo.Slot = slot;
       if (stat != 0) {
          berrno be;
@@ -311,6 +310,7 @@ bool unload_autochanger(DCR *dcr, int loaded)
          dev->Slot = 0;            /* nothing loaded */
       }
       free_pool_memory(changer);
+      unlock_changer(dcr);
    }
    return ok;
 }
@@ -361,6 +361,7 @@ static bool unload_other_drive(DCR *dcr, int slot)
    force_close_device(dev);
 
    POOLMEM *changer_cmd = get_pool_memory(PM_FNAME);
+   lock_changer(dcr);
    Jmsg(jcr, M_INFO, 0,
         _("3307 Issuing autochanger \"unload slot %d, drive %d\" command.\n"),
         slot, dev->drive_index);
@@ -374,10 +375,8 @@ static bool unload_other_drive(DCR *dcr, int slot)
    dcr->VolCatInfo.Slot = slot;
    changer_cmd = edit_device_codes(dcr, changer_cmd, 
                 dcr->device->changer_command, "unload");
-   lock_changer(dcr);
    Dmsg1(200, "Run program=%s\n", changer_cmd);
    int stat = run_program(changer_cmd, timeout, NULL);
-   unlock_changer(dcr);
    dcr->VolCatInfo.Slot = save_slot;
    dcr->dev = save_dev;
    if (stat != 0) {
@@ -393,6 +392,7 @@ static bool unload_other_drive(DCR *dcr, int slot)
       dev->Slot = 0;            /* nothing loaded */
       Dmsg0(200, "Slot unloaded\n");
    }
+   unlock_changer(dcr);
    free_pool_memory(changer_cmd);
    return ok;
 }
@@ -427,14 +427,13 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd)
       unload_autochanger(dcr, -1);
    }
 
+   lock_changer(dcr);
    /* Now issue the command */
    changer = edit_device_codes(dcr, changer, 
                  dcr->device->changer_command, cmd);
    bnet_fsend(dir, _("3306 Issuing autochanger \"%s\" command.\n"), cmd);
-   lock_changer(dcr);
    bpipe = open_bpipe(changer, timeout, "r");
    if (!bpipe) {
-      unlock_changer(dcr);
       bnet_fsend(dir, _("3996 Open bpipe failed.\n"));
       goto bail_out;
    }
@@ -455,7 +454,6 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd)
    }
                  
    stat = close_bpipe(bpipe);
-   unlock_changer(dcr);
    if (stat != 0) {
       berrno be;
       be.set_errno(stat);
@@ -465,6 +463,7 @@ bool autochanger_cmd(DCR *dcr, BSOCK *dir, const char *cmd)
    ok = true;
 
 bail_out:
+   unlock_changer(dcr);
    free_pool_memory(changer);
    return true;
 }
index fbb5f229fd9de68a237e32918ed107d9c23fc4db..78f58fd0771d212ed950c6058e79f1e52a770024 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.38.0"
-#define BDATE   "28 October 2005"
-#define LSMDATE "28Oct05"
+#define BDATE   "04 November 2005"
+#define LSMDATE "04Nov05"
 
 /* Debug flags */
 #undef  DEBUG
@@ -15,7 +15,7 @@
 #define TRACE_FILE 1
 
 /* If this is set stdout will not be closed on startup */
-#define DEVELOPER 1
+/* #define DEVELOPER 1 */
 
 /* Debug flags not normally turned on */