From c9405726e3fb0fbe2478a361d31fa3d12794a4b3 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 7 Jan 2006 15:02:14 +0000 Subject: [PATCH] 07Jan06 - Add PoolId to Job record when updating it at job start time. 06Jan06 - Pull in more code from 1.39 so that there are fewer file differences (the new ua_dotcmds.c, base64.h, crypto.h hmac.c jcr.c (dird and lib) lib.h md5.h parse_conf.c util.c. Aside from ua_dotcmds.c these are mostly crypto upgrades. - Implement new method of walking the jcr chain. The incr/dec of the use_count is done within the walking routines. This should prevent a jcr from being freed from under the walk routines. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2722 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/examples/autochangers/chio-changer | 2 +- bacula/kernstodo | 8 ++- bacula/kes-1.38 | 14 +++++ bacula/src/cats/sql_update.c | 12 ++-- bacula/src/dird/backup.c | 5 +- bacula/src/dird/dird.c | 4 +- bacula/src/dird/job.c | 8 +-- bacula/src/dird/pythondir.c | 5 +- bacula/src/dird/ua_cmds.c | 12 ++-- bacula/src/dird/ua_status.c | 16 ++--- bacula/src/filed/status.c | 12 ++-- bacula/src/jcr.h | 6 +- bacula/src/lib/Makefile.in | 4 +- bacula/src/lib/base64.h | 17 ++---- bacula/src/lib/crypto.h | 6 +- bacula/src/lib/jcr.c | 71 +++++++++++++++++++---- bacula/src/lib/lib.h | 17 ++---- bacula/src/lib/protos.h | 3 + bacula/src/lib/util.c | 2 +- bacula/src/stored/block.h | 19 +++--- bacula/src/stored/status.c | 7 ++- bacula/src/version.h | 6 +- 22 files changed, 159 insertions(+), 97 deletions(-) diff --git a/bacula/examples/autochangers/chio-changer b/bacula/examples/autochangers/chio-changer index 5437cba65f..60b2d5395e 100644 --- a/bacula/examples/autochangers/chio-changer +++ b/bacula/examples/autochangers/chio-changer @@ -120,6 +120,6 @@ case "$COMMAND" in ;; slots) - ${MTX} -f $CHANGER status slot | wc -l + ${MTX} -f $CHANGER status slot | wc -l | bc ;; esac diff --git a/bacula/kernstodo b/bacula/kernstodo index b2a4fb393b..ce5d91d32a 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,5 +1,5 @@ Kern's ToDo List - 26 December 2005 + 07 January 2006 Major development: Project Developer @@ -1271,3 +1271,9 @@ Block Position: 0 === Done - Make sure that all do_prompt() calls in Dir check for -1 (error) and -2 (cancel) returns. +- Fix foreach_jcr() to have free_jcr() inside next(). + jcr=jcr_walk_start(); + for ( ; jcr; (jcr=jcr_walk_next(jcr)) ) + ... + jcr_walk_end(jcr); + diff --git a/bacula/kes-1.38 b/bacula/kes-1.38 index d5b5a4e7a7..bec8fbcee7 100644 --- a/bacula/kes-1.38 +++ b/bacula/kes-1.38 @@ -3,6 +3,20 @@ General: +1.38.4: +07Jan06 +- Add PoolId to Job record when updating it at job start time. +06Jan06 +- Pull in more code from 1.39 so that there are fewer file + differences (the new ua_dotcmds.c, base64.h, crypto.h + hmac.c jcr.c (dird and lib) lib.h md5.h parse_conf.c + util.c. Aside from ua_dotcmds.c these are mostly crypto + upgrades. +- Implement new method of walking the jcr chain. The + incr/dec of the use_count is done within the walking + routines. This should prevent a jcr from being freed + from under the walk routines. + Release 1.38.3 05Jan06: 04Jan06 - Move the suitable_drive flag to a better place to prevent diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 5972e101bf..e008a60913 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -20,7 +20,6 @@ */ - /* The following is necessary so that we do not include * the dummy external definition of DB. */ @@ -54,7 +53,7 @@ db_add_digest_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *digest, int type) { int stat; - char ed1[CRYPTO_DIGEST_MAX_SIZE]; + char ed1[50]; db_lock(mdb); Mmsg(mdb->cmd, "UPDATE File SET MD5='%s' WHERE FileId=%s", digest, @@ -94,7 +93,7 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) struct tm tm; btime_t JobTDate; int stat; - char ed1[50], ed2[50], ed3[50]; + char ed1[50], ed2[50], ed3[50], ed4[50]; stime = jr->StartTime; localtime_r(&stime, &tm); @@ -103,12 +102,13 @@ db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) db_lock(mdb); Mmsg(mdb->cmd, "UPDATE Job SET JobStatus='%c',Level='%c',StartTime='%s'," -"ClientId=%s,JobTDate=%s WHERE JobId=%s", +"ClientId=%s,JobTDate=%s,PoolId=%s WHERE JobId=%s", (char)(jcr->JobStatus), (char)(jr->JobLevel), dt, edit_int64(jr->ClientId, ed1), edit_uint64(JobTDate, ed2), - edit_int64(jr->JobId, ed3)); + edit_int64(jr->JobId, ed3), + edit_int64(jr->PoolId, ed4)); stat = UPDATE_DB(jcr, mdb, mdb->cmd); mdb->changes = 0; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index f9bb0e0e3c..cbc95c61e7 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -14,7 +14,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -100,6 +100,9 @@ bool do_backup_init(JCR *jcr) jcr->PoolId = pr.PoolId; jcr->jr.PoolId = pr.PoolId; + /* + * Fire off any clone jobs (run directives) + */ Dmsg2(900, "cloned=%d run_cmds=%p\n", jcr->cloned, jcr->job->run_cmds); if (!jcr->cloned && jcr->job->run_cmds) { char *runcmd; diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index 20b32fcdd7..63a3b1ea8a 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -431,8 +431,8 @@ void reload_config(int sig) job_end_push(jcr, reload_job_end_cb, (void *)((long int)table)); njobs++; } - free_jcr(jcr); } + endeach_jcr(jcr); } /* Reset globals */ diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 13a52f09ac..6c12e089ce 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -427,7 +427,7 @@ bool cancel_job(UAContext *ua, JCR *jcr) static void job_monitor_destructor(watchdog_t *self) { - JCR *control_jcr = (JCR *) self->data; + JCR *control_jcr = (JCR *)self->data; free_jcr(control_jcr); } @@ -446,8 +446,6 @@ static void job_monitor_watchdog(watchdog_t *self) if (jcr->JobId == 0) { Dmsg2(800, "Skipping JCR %p (%s) with JobId 0\n", jcr, jcr->Job); - /* Keep reference counts correct */ - free_jcr(jcr); continue; } @@ -466,12 +464,12 @@ static void job_monitor_watchdog(watchdog_t *self) cancel_job(ua, jcr); free_ua_context(ua); - Dmsg1(800, "Have cancelled JCR %p\n", jcr); + Dmsg2(800, "Have cancelled JCR %p Job=%d\n", jcr, jcr->JobId); } /* Keep reference counts correct */ - free_jcr(jcr); } + endeach_jcr(jcr); } /* diff --git a/bacula/src/dird/pythondir.c b/bacula/src/dird/pythondir.c index c47ba6a464..17e2f58984 100644 --- a/bacula/src/dird/pythondir.c +++ b/bacula/src/dird/pythondir.c @@ -8,7 +8,7 @@ * */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -337,7 +337,6 @@ static PyObject *job_cancel(PyObject *self, PyObject *args) } foreach_jcr(jcr) { if (jcr->JobId == 0) { - free_jcr(jcr); continue; } if (jcr->JobId == JobId) { @@ -345,6 +344,8 @@ static PyObject *job_cancel(PyObject *self, PyObject *args) break; } } + /* endeach_jcr(jcr) not needed because freed below */ + if (!found) { /* ***FIXME*** raise exception */ return NULL; diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 734943bb49..8a224741f7 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -402,12 +402,11 @@ static int cancel_cmd(UAContext *ua, const char *cmd) /* Count Jobs running */ foreach_jcr(jcr) { if (jcr->JobId == 0) { /* this is us */ - free_jcr(jcr); continue; } - free_jcr(jcr); njobs++; } + endeach_jcr(jcr); if (njobs == 0) { bsendmsg(ua, _("No Jobs running.\n")); @@ -417,13 +416,12 @@ static int cancel_cmd(UAContext *ua, const char *cmd) foreach_jcr(jcr) { char ed1[50]; if (jcr->JobId == 0) { /* this is us */ - free_jcr(jcr); continue; } bsnprintf(buf, sizeof(buf), _("JobId=%s Job=%s"), edit_int64(jcr->JobId, ed1), jcr->Job); add_prompt(ua, buf); - free_jcr(jcr); } + endeach_jcr(jcr); if (do_prompt(ua, _("Job"), _("Choose Job to cancel"), buf, sizeof(buf)) < 0) { return 1; @@ -1356,11 +1354,11 @@ int wait_cmd(UAContext *ua, const char *cmd) foreach_jcr(jcr) { if (jcr->JobId != 0) { running = true; - free_jcr(jcr); break; } - free_jcr(jcr); } + endeach_jcr(jcr); + if (running) { bmicrosleep(1, 0); } diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index d242f6ff2b..b8ade96e21 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2001-2005 Kern Sibbald + Copyright (C) 2001-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -66,8 +66,8 @@ int qstatus_cmd(UAContext *ua, const char *cmd) bsendmsg(ua, DotStatusJob, edit_int64(njcr->JobId, ed1), njcr->JobStatus, njcr->JobErrors); } - free_jcr(njcr); } + endeach_jcr(njcr); } else if (strcasecmp(ua->argk[2], "last") == 0) { bsendmsg(ua, OKqstatus, ua->argk[2]); if ((last_jobs) && (last_jobs->size() > 0)) { @@ -507,7 +507,6 @@ static void list_running_jobs(UAContext *ua) Dmsg0(200, "enter list_run_jobs()\n"); bsendmsg(ua, _("\nRunning Jobs:\n")); foreach_jcr(jcr) { - njobs++; if (jcr->JobId == 0) { /* this is us */ /* this is a console or other control job. We only show console * jobs in the status output. @@ -516,10 +515,12 @@ static void list_running_jobs(UAContext *ua) bstrftime_nc(dt, sizeof(dt), jcr->start_time); bsendmsg(ua, _("Console connected at %s\n"), dt); } - njobs--; - } - free_jcr(jcr); + continue; + } + njobs++; } + endeach_jcr(jcr); + if (njobs == 0) { /* Note the following message is used in regress -- don't change */ bsendmsg(ua, _("No Jobs running.\n====\n")); @@ -531,7 +532,6 @@ static void list_running_jobs(UAContext *ua) bsendmsg(ua, _("======================================================================\n")); foreach_jcr(jcr) { if (jcr->JobId == 0 || !acl_access_ok(ua, Job_ACL, jcr->job->hdr.name)) { - free_jcr(jcr); continue; } njobs++; @@ -650,8 +650,8 @@ static void list_running_jobs(UAContext *ua) free_pool_memory(emsg); pool_mem = false; } - free_jcr(jcr); } + endeach_jcr(jcr); bsendmsg(ua, _("====\n")); Dmsg0(200, "leave list_run_jobs()\n"); } diff --git a/bacula/src/filed/status.c b/bacula/src/filed/status.c index fdeb2abf57..ede4e6d987 100755 --- a/bacula/src/filed/status.c +++ b/bacula/src/filed/status.c @@ -7,7 +7,7 @@ * */ /* - Copyright (C) 2001-2005 Kern Sibbald + Copyright (C) 2001-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -156,7 +156,6 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a } sendit(msg, len, arg); if (njcr->JobId == 0) { - free_jcr(njcr); continue; } sec = time(NULL) - njcr->start_time; @@ -188,8 +187,9 @@ static void do_status(void sendit(const char *msg, int len, void *sarg), void *a len = Mmsg(msg, _(" SDSocket closed.\n")); sendit(msg, len, arg); } - free_jcr(njcr); } + endeach_jcr(njcr); + Dmsg0(1000, "Begin status jcr loop.\n"); if (!found) { len = Mmsg(msg, _("No Jobs running.\n")); @@ -334,8 +334,8 @@ int qstatus_cmd(JCR *jcr) if (njcr->JobId != 0) { bnet_fsend(dir, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors); } - free_jcr(njcr); } + endeach_jcr(njcr); } else if (strcmp(time, "last") == 0) { bnet_fsend(dir, OKqstatus, time); if ((last_jobs) && (last_jobs->size() > 0)) { @@ -460,11 +460,11 @@ char *bac_status(char *buf, int buf_len) if (njcr->JobId != 0) { stat = JS_Running; termstat = _("Bacula Running"); - free_jcr(njcr); break; } - free_jcr(njcr); } + endeach_jcr(njcr); + if (stat != 0) { goto done; } diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 1907f633f9..fde1868eca 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -9,7 +9,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -80,7 +80,9 @@ jcr->JobStatus == JS_FatalError) #define foreach_jcr(jcr) \ - for ((jcr)=NULL; ((jcr)=get_next_jcr(jcr)); ) + for (jcr=jcr_walk_start(); jcr; (jcr=jcr_walk_next(jcr)) ) + +#define endeach_jcr(jcr) jcr_walk_end(jcr) #define SD_APPEND 1 #define SD_READ 0 diff --git a/bacula/src/lib/Makefile.in b/bacula/src/lib/Makefile.in index 0e2e40e0ff..d9809afdbf 100644 --- a/bacula/src/lib/Makefile.in +++ b/bacula/src/lib/Makefile.in @@ -133,12 +133,12 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >>Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ $(MV) Makefile.bak Makefile; \ - echo -e "Something went wrong\n\a"; \ + echo " ===== Something went wrong in make depend ====="; \ fi # ----------------------------------------------------------------------- diff --git a/bacula/src/lib/base64.h b/bacula/src/lib/base64.h index ae33182437..d17f76d16d 100644 --- a/bacula/src/lib/base64.h +++ b/bacula/src/lib/base64.h @@ -7,22 +7,17 @@ */ /* - Copyright (C) 2000-2005 Kern Sibbald and John Walker + Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ diff --git a/bacula/src/lib/crypto.h b/bacula/src/lib/crypto.h index d9cafe794e..17e546bd63 100644 --- a/bacula/src/lib/crypto.h +++ b/bacula/src/lib/crypto.h @@ -19,7 +19,7 @@ * license please contact Landon Fuller . */ /* - Copyright (C) 2005 Kern Sibbald + Copyright (C) 2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -97,8 +97,8 @@ typedef enum { * This must be kept in sync with the available message digest algorithms. * Just in case someone forgets, I've added assertions * to crypto_digest_finalize(). - * MD5: 128 bits - * SHA-1: 160 bits + * MD5: 128 bits + * SHA-1: 160 bits */ #ifndef HAVE_SHA2 #define CRYPTO_DIGEST_MAX_SIZE CRYPTO_DIGEST_SHA1_SIZE diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 3db430beab..cc1a24eaac 100755 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -23,7 +23,7 @@ * */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -388,7 +388,7 @@ void b_free_jcr(const char *file, int line, JCR *jcr) void free_jcr(JCR *jcr) { - Dmsg1(3400, "Enter free_jcr 0x%x\n", jcr); + Dmsg2(3400, "Enter free_jcr 0x%x job=%d\n", jcr, jcr->JobId); #endif @@ -402,7 +402,7 @@ void free_jcr(JCR *jcr) Dmsg3(3400, "Dec free_jcr 0x%x use_count=%d jobid=%d\n", jcr, jcr->use_count, jcr->JobId); if (jcr->use_count > 0) { /* if in use */ unlock_jcr_chain(); - Dmsg2(3400, "free_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg3(3400, "free_jcr 0x%x job=%d use_count=%d\n", jcr, jcr->JobId, jcr->use_count); return; } @@ -574,7 +574,40 @@ static void unlock_jcr_chain() } -JCR *get_next_jcr(JCR *prev_jcr) +/* + * Start walk of jcr chain + * The proper way to walk the jcr chain is: + * JCR *jcr; + * foreach_jcr(jcr) { + * ... + * } + * endeach_jcr(jcr); + * + * It is possible to leave out the endeach_jcr(jcr), but + * in that case, the last jcr referenced must be explicitly + * released with: + * + * free_jcr(jcr); + * + */ +JCR *jcr_walk_start() +{ + JCR *jcr; + lock_jcr_chain(); + jcr = (JCR *)jcrs->first(); + if (jcr) { + jcr->inc_use_count(); + Dmsg3(3400, "Inc jcr_walk_start 0x%x job=%d use_count=%d\n", jcr, + jcr->JobId, jcr->use_count); + } + unlock_jcr_chain(); + return jcr; +} + +/* + * Get next jcr from chain, and release current one + */ +JCR *jcr_walk_next(JCR *prev_jcr) { JCR *jcr; @@ -582,12 +615,31 @@ JCR *get_next_jcr(JCR *prev_jcr) jcr = (JCR *)jcrs->next(prev_jcr); if (jcr) { jcr->inc_use_count(); - Dmsg2(3400, "Inc get_next_jcr 0x%x use_count=%d\n", jcr, jcr->use_count); + Dmsg3(3400, "Inc jcr_walk_next 0x%x job=%d use_count=%d\n", jcr, + jcr->JobId, jcr->use_count); } unlock_jcr_chain(); + if (prev_jcr) { + free_jcr(prev_jcr); + } return jcr; } +/* + * Release last jcr referenced + */ +void jcr_walk_end(JCR *jcr) +{ + if (jcr) { + free_jcr(jcr); + } +} + + +/* + * Setup to call the timeout check routine every 30 seconds + * This routine will check any timers that have been enabled. + */ bool init_jcr_subsystem(void) { watchdog_t *wd = new_watchdog(); @@ -615,7 +667,6 @@ static void jcr_timeout_check(watchdog_t *self) */ foreach_jcr(jcr) { if (jcr->JobId == 0) { - free_jcr(jcr); continue; } fd = jcr->store_bsock; @@ -623,7 +674,7 @@ static void jcr_timeout_check(watchdog_t *self) timer_start = fd->timer_start; if (timer_start && (watchdog_time - timer_start) > fd->timeout) { fd->timer_start = 0; /* turn off timer */ - fd->timed_out = TRUE; + fd->timed_out = true; Jmsg(jcr, M_ERROR, 0, _( "Watchdog sending kill after %d secs to thread stalled reading Storage daemon.\n"), watchdog_time - timer_start); @@ -635,7 +686,7 @@ static void jcr_timeout_check(watchdog_t *self) timer_start = fd->timer_start; if (timer_start && (watchdog_time - timer_start) > fd->timeout) { fd->timer_start = 0; /* turn off timer */ - fd->timed_out = TRUE; + fd->timed_out = true; Jmsg(jcr, M_ERROR, 0, _( "Watchdog sending kill after %d secs to thread stalled reading File daemon.\n"), watchdog_time - timer_start); @@ -647,15 +698,15 @@ static void jcr_timeout_check(watchdog_t *self) timer_start = fd->timer_start; if (timer_start && (watchdog_time - timer_start) > fd->timeout) { fd->timer_start = 0; /* turn off timer */ - fd->timed_out = TRUE; + fd->timed_out = true; Jmsg(jcr, M_ERROR, 0, _( "Watchdog sending kill after %d secs to thread stalled reading Director.\n"), watchdog_time - timer_start); pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL); } } - free_jcr(jcr); } + endeach_jcr(jcr); Dmsg0(3400, "Finished JCR timeout checks\n"); } diff --git a/bacula/src/lib/lib.h b/bacula/src/lib/lib.h index 5b5b6a82e1..88c2fe4d16 100644 --- a/bacula/src/lib/lib.h +++ b/bacula/src/lib/lib.h @@ -9,22 +9,17 @@ */ /* - Copyright (C) 2000-2003 Kern Sibbald and John Walker + Copyright (C) 2000-2005 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index 3d5601fe28..3e8975cb75 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -167,6 +167,9 @@ void write_state_file(char *dir, const char *progname, int port); void job_end_push(JCR *jcr, void job_end_cb(JCR *jcr,void *), void *ctx); void lock_jobs(); void unlock_jobs(); +JCR *jcr_walk_start(); +JCR *jcr_walk_next(JCR *prev_jcr); +void jcr_walk_end(JCR *jcr); /* lex.c */ diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index cd91f7bed4..90cf6044a0 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/stored/block.h b/bacula/src/stored/block.h index d230fedf7a..6a2545bc4b 100644 --- a/bacula/src/stored/block.h +++ b/bacula/src/stored/block.h @@ -7,22 +7,17 @@ * */ /* - Copyright (C) 2000-2004 Kern Sibbald and John Walker + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. */ @@ -30,7 +25,7 @@ #ifndef __BLOCK_H #define __BLOCK_H 1 -#define MAX_BLOCK_LENGTH 500001 /* this is a sort of sanity check */ +#define MAX_BLOCK_LENGTH (1024*1024 + 1) /* this is a sort of sanity check */ #define DEFAULT_BLOCK_SIZE (512 * 126) /* 64,512 N.B. do not use 65,636 here */ /* Block Header definitions. */ diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 99c0c720b9..3ad2076e06 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -7,7 +7,7 @@ * */ /* - Copyright (C) 2003-2005 Kern Sibbald + Copyright (C) 2003-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -330,8 +330,9 @@ static void list_running_jobs(BSOCK *user) } #endif } - free_jcr(jcr); } + endeach_jcr(jcr); + if (!found) { bnet_fsend(user, _("No Jobs running.\n")); } @@ -499,8 +500,8 @@ bool qstatus_cmd(JCR *jcr) if (njcr->JobId != 0) { bnet_fsend(dir, DotStatusJob, njcr->JobId, njcr->JobStatus, njcr->JobErrors); } - free_jcr(njcr); } + endeach_jcr(njcr); } else if (strcmp(time.c_str(), "last") == 0) { bnet_fsend(dir, OKqstatus, time.c_str()); if ((last_jobs) && (last_jobs->size() > 0)) { diff --git a/bacula/src/version.h b/bacula/src/version.h index 05a053421f..10513be5fc 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "1.39.3" -#define BDATE "17 December 2005" -#define LSMDATE "17Dec05" +#define VERSION "1.39.4" +#define BDATE "06 January 2006" +#define LSMDATE "06Jan06" /* Debug flags */ #undef DEBUG -- 2.39.5