]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Close bat console windows first to eliminate error message
authorKern Sibbald <kern@sibbald.com>
Mon, 14 Apr 2008 07:08:34 +0000 (07:08 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 14 Apr 2008 07:08:34 +0000 (07:08 +0000)
     from the notifier.
kes  Remove useless code in Scheduler that causes seg fault on
     termination.
kes  Correct some SD catalog request error messages.
kes  Don't allow pruning of any running job.
kes  Turn off code in read_record that cause seg fault in the SD
     when reading past an EOS_LABEL.
kes  Turn off unloading the autochanger in reserve.c as it just
     causes problems.
kes  Lock volumes when unreserving a device.
kes  Do not mark volume unused when recycling.
kes  When acquiring, don't mark volume unused if it is reserved (busy).

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6812 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/catreq.c
bacula/src/dird/scheduler.c
bacula/src/dird/ua_prune.c
bacula/src/qt-console/mainwin.cpp
bacula/src/stored/acquire.c
bacula/src/stored/label.c
bacula/src/stored/read_record.c
bacula/src/stored/reserve.c
bacula/src/version.h
bacula/technotes-2.1

index dcc58a48a51ad75af491e7bfca18b3683b50c22a..224d5e7e2b59d6b60a6412df36d0edf1a903005f 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -328,7 +328,7 @@ void catalog_request(JCR *jcr, BSOCK *bs)
       if (!db_create_jobmedia_record(jcr, jcr->db, &jm)) {
          Jmsg(jcr, M_FATAL, 0, _("Catalog error creating JobMedia record. %s"),
             db_strerror(jcr->db));
-         bs->fsend(_("1991 Update JobMedia error\n"));
+         bs->fsend(_("1992 Create JobMedia error\n"));
       } else {
          Dmsg0(400, "JobMedia record created\n");
          bs->fsend(OK_create);
@@ -373,7 +373,7 @@ void catalog_update(JCR *jcr, BSOCK *bs)
    if (!jcr->db) {
       omsg = get_memory(bs->msglen+1);
       pm_strcpy(omsg, bs->msg);
-      bs->fsend(_("1991 Invalid Catalog Update: %s"), omsg);    
+      bs->fsend(_("1994 Invalid Catalog Update: %s"), omsg);    
       Jmsg1(jcr, M_FATAL, 0, _("Invalid Catalog Update; DB not open: %s"), omsg);
       free_memory(omsg);
       goto bail_out;
index 0e888a7c128708033949faa0443bed4205bc24a0..095157d535c1e97db14bb825b042739ed63dc44f 100644 (file)
@@ -246,11 +246,6 @@ again:
 void term_scheduler()
 {
    if (jobs_to_run) {
-      job_item *je;
-      /* Release all queued job entries to be run */
-      foreach_dlist(je, jobs_to_run) {
-         free(je);
-      }
       delete jobs_to_run;
    }
 }
@@ -285,7 +280,7 @@ static void find_runs()
    woy = tm_woy(now);                     /* get week of year */
 
    Dmsg7(dbglvl, "now = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
-        now, hour, month, mday, wday, wom, woy);
+         now, hour, month, mday, wday, wom, woy);
 
    /*
     * Compute values for next hour from now.
@@ -303,7 +298,7 @@ static void find_runs()
    nh_woy = tm_woy(now);                     /* get week of year */
 
    Dmsg7(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
-        next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy);
+         next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy);
 
    /* Loop through all jobs */
    LockRes();
@@ -357,20 +352,20 @@ static void find_runs()
 
          Dmsg3(dbglvl, "run@%p: run_now=%d run_nh=%d\n", run, run_now, run_nh);
 
-        if (run_now || run_nh) {
-          /* find time (time_t) job is to be run */
-          (void)localtime_r(&now, &tm);      /* reset tm structure */
-          tm.tm_min = run->minute;     /* set run minute */
-          tm.tm_sec = 0;               /* zero secs */
-          runtime = mktime(&tm);
-          if (run_now) {
-            add_job(job, run, now, runtime);
-          }
-          /* If job is to be run in the next hour schedule it */
-          if (run_nh) {
-            add_job(job, run, now, runtime + 3600);
-          }
-        }
+         if (run_now || run_nh) {
+           /* find time (time_t) job is to be run */
+           (void)localtime_r(&now, &tm);      /* reset tm structure */
+           tm.tm_min = run->minute;     /* set run minute */
+           tm.tm_sec = 0;               /* zero secs */
+           runtime = mktime(&tm);
+           if (run_now) {
+             add_job(job, run, now, runtime);
+           }
+           /* If job is to be run in the next hour schedule it */
+           if (run_nh) {
+             add_job(job, run, now, runtime + 3600);
+           }
+         }
       }
    }
    UnlockRes();
index f90dd2e06bd26607f353f94c97c07d9d84cff822..6592ac8fad75eb042e82572c690da61e722ad105 100644 (file)
@@ -455,10 +455,18 @@ int get_prune_list_for_volume(UAContext *ua, MEDIA_DBR *mr, del_ctx *del)
       goto bail_out;
    }
 
+   /* Do not prune any job currently running */
    for (i=0; i < del->num_ids; i++) {
-      if (ua->jcr->JobId == del->JobId[i]) {
-         Dmsg2(150, "skip same job JobId[%d]=%d\n", i, (int)del->JobId[i]);
-         del->JobId[i] = 0;
+      skip = false;
+      foreach_jcr(jcr) {
+         if (jcr->JobId == del->JobId[i]) {
+            Dmsg2(150, "skip same job JobId[%d]=%d\n", i, (int)del->JobId[i]);
+            del->JobId[i] = 0;
+            skip = true;
+            break;
+         }
+      }
+      if (skip) {
          continue;
       }
       Dmsg2(150, "accept JobId[%d]=%d\n", i, (int)del->JobId[i]);
index 92cc016051a4b85519d778d42d199a6372caa195..079c2a2f7a6baa6e401832048330013a74a7bdd9 100644 (file)
@@ -247,6 +247,16 @@ void MainWin::closeEvent(QCloseEvent *event)
 {
    m_isClosing = true;
    writeSettings();
+   /*
+    * Close the console pages before non-console pages so that
+    *  the notifier is turned off. Otherwise it prints an error when
+    *  the page it is using gets destroyed.
+    */
+   foreach(Console *console, m_consoleHash){
+      console->writeSettings();
+      console->terminate();
+      console->closeStackPage();
+   }
    /* close all non console pages, this will call settings in destructors */
    while (m_consoleHash.count() < m_pagehash.count()) {
       foreach(Pages *page, m_pagehash) {
@@ -259,12 +269,6 @@ void MainWin::closeEvent(QCloseEvent *event)
          }
       }
    }
-   /* close the console pages and terminate connection */
-   foreach(Console *console, m_consoleHash){
-      console->writeSettings();
-      console->terminate();
-      console->closeStackPage();
-   }
    event->accept();
 }
 
index ad1f344fce7757d19d9d19083739d5e49e9a881a..482fcca93e2da754d3e625ff1f786f926a3d6d02 100644 (file)
@@ -524,7 +524,7 @@ bool release_device(DCR *dcr)
             dev->weof(1);
             write_ansi_ibm_labels(dcr, ANSI_EOF_LABEL, dev->VolHdr.VolumeName);
          }
-         if (!dev->num_writers) {             /* if no more writers */
+         if (!dev->is_busy()) {               /* if no more writers */
             volume_unused(dcr);               /*  we obviously are not using the volume */
          }
          if (!dev->at_weot()) {
index 115f7ae0d1e1f53f82979e9e154f24f1a3784135..5ec6a72b68141e9a2821a0b83e2352e152727c5d 100644 (file)
@@ -455,7 +455,6 @@ bool rewrite_volume_label(DCR *dcr, bool recycle)
          return false;
       }
       if (recycle) {
-         volume_unused(dcr);             /* mark volume unused */
          if (!dev->truncate(dcr)) {
             Jmsg2(jcr, M_FATAL, 0, _("Truncate error on device %s: ERR=%s\n"),
                   dev->print_name(), dev->print_errmsg());
index 4190d11848b4d62f94bcd618a8917e10e680e95a..ab9d0e60a1116cb4d0b34b5c8102d92b895449b5 100644 (file)
@@ -228,11 +228,14 @@ bool read_records(DCR *dcr,
              *  he wants to know if they matched the bsr, then he must
              *  check the match_stat in the record */
             ok = record_cb(dcr, rec);
+#ifdef xxx
             /*
              * If this is the end of the Session (EOS) for this record
              *  we can remove the record.  Note, there is a separate
              *  record to read each session. If a new session is seen
              *  a new record will be created at approx line 157 above.
+             *
+             * This code causes a seg fault in the enclosing for() loop.
              */
             if (rec->FileIndex == EOS_LABEL) {
                Dmsg2(dbglvl, "Remove EOS rec. SI=%d ST=%d\n", rec->VolSessionId,
@@ -240,6 +243,7 @@ bool read_records(DCR *dcr,
                recs->remove(rec);
                free_record(rec);
             }
+#endif
             continue;
          } /* end if label record */
 
index 51502c0d248455035fc1201d6b27459669247182..e654a912a6665ab202eba5024011f62fb12cb35e 100644 (file)
@@ -347,7 +347,7 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName)
             goto get_out;
          }
          Dmsg3(dbglvl, "jid=%u reserve_vol free vol=%s at %p\n", jid(), vol->vol_name, vol->vol_name);
-         unload_autochanger(dcr, -1);   /* unload the volume */
+//       unload_autochanger(dcr, -1);   /* unload the volume */
          free_volume(dev);
          debug_list_volumes("reserve_vol free");
       }
@@ -464,6 +464,7 @@ VOLRES *find_volume(DCR *dcr)
 void unreserve_device(DCR *dcr)
 {
    DEVICE *dev = dcr->dev;
+   lock_volumes();
    if (dcr->reserved_device) {
       dcr->reserved_device = false;
       dev->reserved_device--;
@@ -481,6 +482,7 @@ void unreserve_device(DCR *dcr)
          volume_unused(dcr);
       }
    }
+   unlock_volumes();
 }
 
 /*  
@@ -1404,10 +1406,14 @@ static bool is_max_jobs_ok(DCR *dcr)
    DEVICE *dev = dcr->dev;
    JCR *jcr = dcr->jcr;
 
-   Dmsg4(dbglvl, "MaxJobs=%d Jobs=%d reserves=%d Vol=%s\n",
+   Dmsg5(dbglvl, "MaxJobs=%d Jobs=%d reserves=%d Status=%s Vol=%s\n",
          dcr->VolCatInfo.VolCatMaxJobs,
          dcr->VolCatInfo.VolCatJobs, dev->reserved_device,
+         dcr->VolCatInfo.VolCatStatus,
          dcr->VolumeName);
+   if (strcmp(dcr->VolCatInfo.VolCatStatus, "Recycle") == 0) {
+      return true;
+   }
    if (dcr->VolCatInfo.VolCatMaxJobs > 0 && dcr->VolCatInfo.VolCatMaxJobs <=
         (dcr->VolCatInfo.VolCatJobs + dev->reserved_device)) {
       /* Max Job Vols depassed or already reserved */
index c3853541c771601a22920bac72c33508c4e67f87..07ec4c4a9655b5c098a9f8f7ce85ab8190376fdd 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "2.2.9-b6"
-#define BDATE   "07 April 2008"
-#define LSMDATE "07Apr08"
+#define VERSION "2.2.9-b7"
+#define BDATE   "14 April 2008"
+#define LSMDATE "14Apr08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index 13148860f7741c6d4ef6bae9b0dd975b7cfcdda0..4e6701c8c87c617fb985555c595605bcfac9ea4e 100644 (file)
@@ -1,6 +1,22 @@
               Technical notes on version 2.2
 
 General:
+14Apr08
+kes  Close bat console windows first to eliminate error message
+     from the notifier.
+kes  Remove useless code in Scheduler that causes seg fault on
+     termination.
+kes  Correct some SD catalog request error messages.
+kes  Don't allow pruning of any running job.
+kes  Turn off code in read_record that causes a seg fault in the SD
+     when reading past an EOS_LABEL.
+kes  Turn off unloading the autochanger in reserve.c as it just
+     causes problems.
+kes  Lock volumes when unreserving a device.
+kes  Do not mark volume unused when recycling.
+kes  When acquiring, don't mark volume unused if it is reserved (busy).
+
+Beta Release Version 2.2.9-b6
 06Apr08
 kes  Eliminate ./configure warning on po directory 
 kes  Fix bug #1063, reuse of freed ptr in list nextvol.