]> git.sur5r.net Git - bacula/bacula/commitdiff
- Add user supplied patch to add inet_aton() of old Solaris
authorKern Sibbald <kern@sibbald.com>
Fri, 3 Dec 2004 21:00:19 +0000 (21:00 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 3 Dec 2004 21:00:19 +0000 (21:00 +0000)
  systems.
- Require pools to match before allowing multiple simultaneous
  accesses to same storage resource.
- Add patch supplied by Martin to correct buffer overrun in
  bsnprintf() with no library snprintf().

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

bacula/kernstodo
bacula/src/dird/jobq.c
bacula/src/lib/bnet.c
bacula/src/lib/bsys.c
bacula/src/lib/jcr.c
bacula/src/version.h

index 14ebef85a8e29d82cb4beea7fc55892e67138840..29e7a2db570234eee1e16c53a1206e9233d2eb2d 100644 (file)
@@ -40,6 +40,7 @@ Regression tests:
 
 
 1.37 Possibilities:
+- Browse generations of files.
 - Add offline command to Bacula console.
 - I've seen an error when my catalog's File table fills up.  I
    then have to recreate the File table with a larger maximum row
index 12e2c434c190b562aceded4f769ae6d34d513f29..dd92d6ff319993633d7422b2532d44ff90a71a0e 100755 (executable)
@@ -40,6 +40,7 @@
 #include "bacula.h"
 #include "dird.h"
 
+extern JCR *jobs;
 
 /* Forward referenced functions */
 extern "C" void *jobq_server(void *arg);
@@ -47,6 +48,8 @@ extern "C" void *sched_wait(void *arg);
 
 static int   start_server(jobq_t *jq);
 
+
+
 /*   
  * Initialize a job queue
  *
@@ -544,6 +547,7 @@ void *jobq_server(void *arg)
         for ( ; je;  ) {
            /* je is current job item on the queue, jn is the next one */
            JCR *jcr = je->jcr;
+           bool skip_this_jcr = false;
            jobq_item_t *jn = (jobq_item_t *)jq->waiting_jobs->next(je);
             Dmsg3(300, "Examining Job=%d JobPri=%d want Pri=%d\n",
               jcr->JobId, jcr->JobPriority, Priority);
@@ -560,14 +564,40 @@ void *jobq_server(void *arg)
                  jcr->store->MaxConcurrentJobs = 1;
               } else {
                  set_jcr_job_status(jcr, JS_WaitStoreRes);
-                 je = jn;
+                 je = jn;            /* point to next waiting job */
                  continue;
               }
+           /* We are not doing a Restore or Verify */
+           } else if (jcr->store->NumConcurrentJobs == 0 &&
+                      jcr->store->NumConcurrentJobs < jcr->store->MaxConcurrentJobs) {
+               /* Simple case, first job */
+               jcr->store->NumConcurrentJobs = 1;  
            } else if (jcr->store->NumConcurrentJobs < jcr->store->MaxConcurrentJobs) {
-              jcr->store->NumConcurrentJobs++;
-           } else {
+              /*
+               * At this point, we already have at least one Job running 
+               *  for this Storage daemon, so we must ensure that there
+               *  is no Volume conflict. In general, it should be OK, if
+               *  all Jobs pull from the same Pool, so we check the Pools.
+               */
+               JCR *njcr;
+               lock_jcr_chain();
+               for (njcr=jobs; njcr; njcr=njcr->next) {
+                  if (njcr->JobId == 0 || njcr == jcr) {
+                     continue;
+                  }
+                  if (njcr->pool != jcr->pool) {
+                     skip_this_jcr = true;
+                     break;
+                  }
+               }  
+               unlock_jcr_chain();
+               if (!skip_this_jcr) {
+                  jcr->store->NumConcurrentJobs++;    
+               }
+           } 
+           if (skip_this_jcr) {
               set_jcr_job_status(jcr, JS_WaitStoreRes);
-              je = jn;
+              je = jn;               /* point to next waiting job */
               continue;
            }
 
@@ -580,7 +610,7 @@ void *jobq_server(void *arg)
                  jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;  
               }
               set_jcr_job_status(jcr, JS_WaitClientRes);
-              je = jn;
+              je = jn;               /* point to next waiting job */
               continue;
            }
            if (jcr->job->NumConcurrentJobs < jcr->job->MaxConcurrentJobs) {
@@ -593,7 +623,7 @@ void *jobq_server(void *arg)
               }
               jcr->client->NumConcurrentJobs--;
               set_jcr_job_status(jcr, JS_WaitJobRes);
-              je = jn;
+              je = jn;               /* Point to next waiting job */
               continue;
            }
            /* Got all locks, now remove it from wait queue and append it
@@ -603,7 +633,7 @@ void *jobq_server(void *arg)
            jq->waiting_jobs->remove(je);
            jq->ready_jobs->append(je);
             Dmsg1(300, "moved JobId=%d from wait to ready queue\n", je->jcr->JobId);
-           je = jn;
+           je = jn;                  /* Point to next waiting job */
         } /* end for loop */
         break;
       } /* end while loop */
index 54df1e66aae8aae3510de1c08044b95317de31f4..bf8fe9d457bdfdad2db0d42423f30bc4e108a3f7 100644 (file)
@@ -54,6 +54,19 @@ extern time_t watchdog_time;
 #endif
 
 
+#ifdef HAVE_OLD_SOCKOPT
+int inet_aton(const char *cp, struct in_addr *inp)
+{
+   struct in_addr inaddr;
+
+   if((inaddr.s_addr = inet_addr(cp)) != INADDR_NONE) {
+      inp->s_addr = inaddr.s_addr;
+      return 1;
+   }
+   return 0;
+}
+#endif
+
 /*
  * Read a nbytes from the network.
  * It is possible that the total bytes require in several
index b0d6cb240cc0b035f70cc88ca5946c367db61943..088faad840b893ee94646517b671ce1f21977193 100644 (file)
@@ -150,15 +150,16 @@ int bvsnprintf(char *str, int32_t size, const char  *format, va_list ap)
 
 #else
 
-   int len;
+   int len, buflen;
    char *buf;
-   buf = get_memory(BIG_BUF);
+   buflen = size > BIG_BUF ? size : BIG_BUF;
+   buf = get_memory(buflen);
    len = vsprintf(buf, format, ap);
-   if (len >= BIG_BUF) {
+   if (len >= buflen) {
       Emsg0(M_ABORT, 0, _("Buffer overflow.\n"));
    }
-   memcpy(str, buf, size);
-   str[size-1] = 0;
+   memcpy(str, buf, len);
+   str[len] = 0;               /* len excludes the null */
    free_memory(buf);
    return len;
 #endif
index ebbfd79275ca27c067bf9f48356b9b7c0b46e42e..596232df07eab18c33ef6e9da26892d36ab324c6 100755 (executable)
@@ -43,7 +43,7 @@ int num_jobs_run;
 dlist *last_jobs = NULL;
 const int max_last_jobs = 10;
 
-static JCR *jobs = NULL;             /* pointer to JCR chain */
+JCR *jobs = NULL;                    /* pointer to JCR chain */
 static brwlock_t lock;               /* lock for last jobs and JCR chain */
 
 void init_last_jobs_list()
index 0dcfe754d66bb01f7c58de867abc2e706c8db571..a17049247a28bd1ca334e8c868b931546df11eae 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.37.1"
-#define BDATE   "02 December 2004"
-#define LSMDATE "02Dec04"
+#define BDATE   "03 December 2004"
+#define LSMDATE "03Dec04"
 
 /* Debug flags */
 #undef  DEBUG