From: Kern Sibbald Date: Mon, 14 Apr 2008 07:08:34 +0000 (+0000) Subject: kes Close bat console windows first to eliminate error message X-Git-Tag: Release-2.2.9-b7~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9c5f7fbcb9ccf23876bae25dee36a5a9a3cdd99f;p=bacula%2Fbacula 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 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 --- diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index dcc58a48a5..224d5e7e2b 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -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; diff --git a/bacula/src/dird/scheduler.c b/bacula/src/dird/scheduler.c index 0e888a7c12..095157d535 100644 --- a/bacula/src/dird/scheduler.c +++ b/bacula/src/dird/scheduler.c @@ -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(); diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index f90dd2e06b..6592ac8fad 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -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]); diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 92cc016051..079c2a2f7a 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -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(); } diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index ad1f344fce..482fcca93e 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -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()) { diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 115f7ae0d1..5ec6a72b68 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -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()); diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 4190d11848..ab9d0e60a1 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -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 */ diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 51502c0d24..e654a912a6 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -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 */ diff --git a/bacula/src/version.h b/bacula/src/version.h index c3853541c7..07ec4c4a96 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 13148860f7..4e6701c8c8 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -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.