From f98398be0fb2f726262b1dbded1cf8652a15b96f Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 10 Dec 2007 20:13:04 +0000 Subject: [PATCH] ebl update, first tests are ok git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6036 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/testing/bug_897_1005.patch | 96 ++++++++++++++++++----- 1 file changed, 76 insertions(+), 20 deletions(-) diff --git a/bacula/patches/testing/bug_897_1005.patch b/bacula/patches/testing/bug_897_1005.patch index 34f732e649..23c6fb0d27 100644 --- a/bacula/patches/testing/bug_897_1005.patch +++ b/bacula/patches/testing/bug_897_1005.patch @@ -1,6 +1,6 @@ Index: src/dird/backup.c =================================================================== ---- src/dird/backup.c (révision 5819) +--- src/dird/backup.c (révision 6032) +++ src/dird/backup.c (copie de travail) @@ -245,8 +245,7 @@ set_jcr_job_status(jcr, JS_ErrorTerminated); @@ -8,7 +8,7 @@ Index: src/dird/backup.c /* Cancel SD */ - cancel_storage_daemon_job(jcr); - wait_for_storage_daemon_termination(jcr); -+ wait_for_job_termination(jcr, 300); ++ wait_for_job_termination(jcr, FDConnectTimeout); Dmsg1(400, "after wait for sd. use=%d\n", jcr->use_count()); return false; } @@ -21,33 +21,89 @@ Index: src/dird/backup.c { int32_t n = 0; BSOCK *fd = jcr->file_bsock; -@@ -268,8 +267,13 @@ +@@ -268,32 +267,42 @@ uint64_t JobBytes = 0; int VSS = 0; int Encrypt = 0; + btimer_t *tid=NULL; set_jcr_job_status(jcr, JS_Running); +- /* Wait for Client to terminate */ +- while ((n = bget_dirmsg(fd)) >= 0) { +- if (!fd_ok && +- (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles, +- &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 || +- sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, +- &ReadBytes, &JobBytes, &Errors) == 5)) { +- fd_ok = true; +- set_jcr_job_status(jcr, jcr->FDJobStatus); +- Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus); +- } else { +- Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"), +- fd->msg); + -+ if (timeout) { -+ tid = start_bsock_timer(fd, timeout); /* TODO: use user timeout */ -+ } - /* Wait for Client to terminate */ - while ((n = bget_dirmsg(fd)) >= 0) { - if (!fd_ok && -@@ -288,6 +292,9 @@ - break; ++ if (fd) { ++ if (timeout) { ++ tid = start_bsock_timer(fd, timeout); /* TODO: use user timeout */ + } +- if (job_canceled(jcr)) { +- break; ++ /* Wait for Client to terminate */ ++ while ((n = bget_dirmsg(fd)) >= 0) { ++ if (!fd_ok && ++ (sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles, ++ &ReadBytes, &JobBytes, &Errors, &VSS, &Encrypt) == 7 || ++ sscanf(fd->msg, OldEndJob, &jcr->FDJobStatus, &JobFiles, ++ &ReadBytes, &JobBytes, &Errors) == 5)) { ++ fd_ok = true; ++ set_jcr_job_status(jcr, jcr->FDJobStatus); ++ Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus); ++ } else { ++ Jmsg(jcr, M_WARNING, 0, _("Unexpected Client Job message: %s\n"), ++ fd->msg); ++ } ++ if (job_canceled(jcr)) { ++ break; ++ } } +- } ++ if (tid) { ++ stop_bsock_timer(tid); ++ } + +- if (is_bnet_error(fd)) { +- Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), +- job_type_to_str(jcr->JobType), fd->bstrerror()); ++ if (is_bnet_error(fd)) { ++ Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), ++ job_type_to_str(jcr->JobType), fd->bstrerror()); ++ } ++ fd->signal(BNET_TERMINATE); /* tell Client we are terminating */ } -+ if (tid) { -+ stop_bsock_timer(tid); -+ } +- fd->signal(BNET_TERMINATE); /* tell Client we are terminating */ - if (is_bnet_error(fd)) { - Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"), + /* Force cancel in SD if failing */ + if (job_canceled(jcr) || !fd_ok) { +@@ -303,7 +312,6 @@ + /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */ + wait_for_storage_daemon_termination(jcr); + +- + /* Return values from FD */ + if (fd_ok) { + jcr->JobFiles = JobFiles; +@@ -320,7 +328,7 @@ + // jcr->JobStatus, jcr->SDJobStatus); + + /* Return the first error status we find Dir, FD, or SD */ +- if (!fd_ok || is_bnet_error(fd)) { ++ if (!fd_ok || is_bnet_error(fd)) { /* if fd not set, that use !fd_ok */ + jcr->FDJobStatus = JS_ErrorTerminated; + } + if (jcr->JobStatus != JS_Terminated) { Index: src/dird/protos.h =================================================================== ---- src/dird/protos.h (révision 5819) +--- src/dird/protos.h (révision 6032) +++ src/dird/protos.h (copie de travail) @@ -52,7 +52,7 @@ extern bool find_recycled_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr); @@ -60,13 +116,13 @@ Index: src/dird/protos.h extern void backup_cleanup(JCR *jcr, int TermCode); Index: src/filed/job.c =================================================================== ---- src/filed/job.c (révision 5856) +--- src/filed/job.c (révision 6032) +++ src/filed/job.c (copie de travail) @@ -269,6 +269,16 @@ /* Run the after job */ run_scripts(jcr, jcr->RunScripts, "ClientAfterJob"); -+ if (jcr->JobId) { ++ if (jcr->JobId) { /* send EndJob if running a job */ + char ed1[50], ed2[50]; + /* Send termination status back to Dir */ + bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles, @@ -180,7 +236,7 @@ Index: src/filed/job.c } Index: src/jcr.h =================================================================== ---- src/jcr.h (révision 5856) +--- src/jcr.h (révision 6032) +++ src/jcr.h (copie de travail) @@ -301,6 +301,7 @@ int32_t pki_session_encoded_size; /* Size of DER-encoded pki_session */ -- 2.39.5