From: Kern Sibbald Date: Mon, 18 Oct 2004 15:29:00 +0000 (+0000) Subject: - Fix crash on exit with -t option in FD on 2.6 kernels -- X-Git-Tag: Release-1.36.0~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d54db6839926e0af0385c079c37afe5dfb52fa58;p=bacula%2Fbacula - Fix crash on exit with -t option in FD on 2.6 kernels -- uninitialized thread id variable. - Add additional SD and FD debug info to detect network hang. - Fix bnet_strerror() routine not to return stack pointer. - Put latest update routines in updatedb. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1655 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/LICENSE b/bacula/LICENSE index c7bf85e736..acd46e9114 100644 --- a/bacula/LICENSE +++ b/bacula/LICENSE @@ -6,24 +6,46 @@ The name Bacula is a registered trademark. License: For the most part, Bacula is licensed under the GPL version 2 or greater and any code that is Copyright Kern Sibbald and John Walker with the GPL -indication is so licensed, but with the following two additions: +indication is so licensed, but with the following four additions: -Linking: Bacula may be linked with any libraries permitted under +Linking: +Bacula may be linked with any libraries permitted under the GPL, or with any non-GPLed libraries, including OpenSSL, that are required for its proper functioning, providing the source code of those non-GPLed libraries is non-proprietary and freely available. -Termination for Patent Action: In addition to the termination -clause specified in the GPL, this license shall terminate -automatically and you may no longer exercise any of the rights -granted to you by this license as of the date you commence an -action, including a cross-claim or counterclaim, against any -licensor of GPL software alleging that the software infringes -an intellectual property right or a patent. Special dispensation -from or delay to the execution of this clause may be possible -by applying directly to the license owner of this software. -Such a dispensation or delay is valid only in writing and signed -by the one or more of the license holders. +Termination for Patent Action: +In addition to the termination clause specified in the GPL, this +license shall terminate automatically and you may no longer +exercise any of the rights granted to you by this license as of +the date you commence an action, including a cross-claim or +counterclaim, against any licensor of GPL software alleging that +the software infringes an intellectual property right or a +patent. Special dispensation from or delay to the execution of +this clause may be possible by applying directly to the license +owner of this software. Such a dispensation or delay is valid +only in writing and signed by the one or more of the license +holders. + +IP rights: +Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are +provided by any Contributor that the Program does not infringe +the patent or other intellectual property rights of any other +entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to +exercising the rights and licenses granted hereunder, each +Recipient hereby assumes sole responsibility to secure any other +intellectual property rights needed, if any. For example, if a +third party patent license is required to allow Recipient to +distribute the Program, it is Recipient's responsibility to +acquire that license before distributing the Program. + +Copyrights: +Each Contributor represents that to its knowledge it has +sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement. Code falling under the above conditions will be marked as follows: diff --git a/bacula/kernstodo b/bacula/kernstodo index ef0aea25eb..0b440a8289 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -16,6 +16,10 @@ Version 1.35 Kern (see below) Maybe for 1.35: +- Implement Files/Bytes,... stats for restore job. +- Implement Total Bytes Written, ... for restore job. +- Check dates entered by user for correctness (month/day/... ranges) +- Compress restore Volume listing by date and first file. - Add Pool/Storage override regression test. - Add delete JobId to regression. - Add bscan to four-concurrent-jobs regression. @@ -1380,4 +1384,3 @@ Block Position: 0 scripts to add them. - Modify postgresql update script to remove bigint FilenameId reference. - diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 582f237231..304f7cafd3 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -370,7 +370,7 @@ static void verify_cleanup(JCR *jcr, int TermCode) // Dmsg1(100, "Enter verify_cleanup() TermCod=%d\n", TermCode); dequeue_messages(jcr); /* display any queued messages */ - Dmsg3(000, "JobLevel=%c Expected=%u JobFiles=%u\n", jcr->JobLevel, + Dmsg3(900, "JobLevel=%c Expected=%u JobFiles=%u\n", jcr->JobLevel, jcr->ExpectedFiles, jcr->JobFiles); if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG && jcr->ExpectedFiles != jcr->JobFiles) { diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 209f95102e..6492cc31c9 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -468,11 +468,11 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr) sd->msg = wbuf; /* set correct write buffer */ if (!bnet_send(sd)) { berrno be; + Jmsg2(jcr, M_FATAL, 0, _("Network send error %d to SD. ERR=%s\n"), + sd->msglen, bnet_strerror(sd)); sd->msg = msgsave; /* restore bnet buffer */ sd->msglen = 0; bclose(&ff_pkt->bfd); - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - bnet_strerror(sd)); return 0; } } diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index 1223a9c5a0..7e0b61effc 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -167,6 +167,7 @@ int main (int argc, char *argv[]) usage(); } + server_tid = pthread_self(); if (!no_signals) { init_signals(terminate_filed); } else { diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index df41939ec6..7f5cdbb440 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -784,7 +784,11 @@ Retrying ...\n", name, host, port, be.strerror()); const char *bnet_strerror(BSOCK * bsock) { berrno be; - return be.strerror(bsock->b_errno); + if (bsock->errmsg == NULL) { + bsock->errmsg = get_pool_memory(PM_MESSAGE); + } + pm_strcpy(bsock->errmsg, be.strerror(bsock->b_errno)); + return bsock->errmsg; } /* diff --git a/bacula/src/lib/bnet_server.c b/bacula/src/lib/bnet_server.c index b97ba237e3..8d8cfbb15e 100644 --- a/bacula/src/lib/bnet_server.c +++ b/bacula/src/lib/bnet_server.c @@ -52,7 +52,9 @@ static bool quit = false; void bnet_stop_thread_server(pthread_t tid) { quit = true; - pthread_kill(tid, TIMEOUT_SIGNAL); + if (!pthread_equal(tid, pthread_self())) { + pthread_kill(tid, TIMEOUT_SIGNAL); + } } /* diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index 0c4bd4d231..71af6a700c 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -50,7 +50,7 @@ struct BSOCK { POOLMEM *msg; /* message pool buffer */ char *who; /* Name of daemon to which we are talking */ char *host; /* Host name/IP */ - POOLMEM *errmsg; /* edited error message (to be implemented) */ + POOLMEM *errmsg; /* edited error message */ RES *res; /* Resource to which we are connected */ BSOCK *next; /* next BSOCK if duped */ FILE *spool_fd; /* spooling file */ diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index f160778eb7..2b5cbc5bf5 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -231,8 +231,11 @@ bool do_append_data(JCR *jcr) jcr->dir_bsock->spool = false; } } + Dmsg0(350, "Enter bnet_get\n"); } + Dmsg1(350, "End read loop with FD. Stat=%d\n", n); if (is_bnet_error(ds)) { + Dmsg1(350, "Network read error from FD. ERR=%s\n", bnet_strerror(ds)); Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"), bnet_strerror(ds)); ok = false; diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 4a45fb86c7..27fe7618cc 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -354,14 +354,14 @@ void *device_allocation(void *arg) /* Clean up and then exit */ void terminate_stored(int sig) { - static int in_here = FALSE; + static bool in_here = false; DEVRES *device; JCR *jcr; if (in_here) { /* prevent loops */ exit(1); } - in_here = TRUE; + in_here = true; if (sig == SIGTERM) { /* normal shutdown request? */ /* @@ -380,8 +380,8 @@ void terminate_stored(int sig) set_jcr_job_status(jcr, JS_Canceled); fd = jcr->file_bsock; if (fd) { - fd->timed_out = TRUE; - Dmsg1(100, "killing JobId=%d\n", jcr->JobId); + fd->timed_out = true; + Dmsg1(100, "term_stored killing JobId=%d\n", jcr->JobId); pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL); if (jcr->device && jcr->device->dev && jcr->device->dev->dev_blocked) { pthread_cond_signal(&jcr->device->dev->wait_next_vol); diff --git a/bacula/src/version.h b/bacula/src/version.h index 1f4dc41407..921434b8f3 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.35.9" -#define BDATE "16 October 2004" -#define LSMDATE "16Oct04" +#define BDATE "18 October 2004" +#define LSMDATE "18Oct04" /* Debug flags */ #undef DEBUG diff --git a/bacula/updatedb/update_mysql_tables_7_to_8 b/bacula/updatedb/update_mysql_tables_7_to_8 index 58a50eff9f..8e41e871f5 100755 --- a/bacula/updatedb/update_mysql_tables_7_to_8 +++ b/bacula/updatedb/update_mysql_tables_7_to_8 @@ -15,17 +15,13 @@ USE bacula; ALTER TABLE Media ADD COLUMN EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0; ALTER TABLE Media ADD COLUMN EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE File ADD INDEX (JobId, PathId, FilenameId); + UPDATE Filename SET Name='' WHERE Name=' '; DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (8); -CREATE TABLE CDImages ( - MediaId INTEGER UNSIGNED NOT NULL, - LastBurn DATETIME NOT NULL, - PRIMARY KEY (MediaId) - ); - END-OF-DATA then echo "Update of Bacula MySQL tables succeeded." diff --git a/bacula/updatedb/update_postgresql_tables_7_to_8 b/bacula/updatedb/update_postgresql_tables_7_to_8 index b2dd8e60a2..84b2f0e3b3 100755 --- a/bacula/updatedb/update_postgresql_tables_7_to_8 +++ b/bacula/updatedb/update_postgresql_tables_7_to_8 @@ -12,20 +12,24 @@ bindir=/home/kern/bacula/depkgs/sqlite if $bindir/psql $* -f - <