From 99ebdd4001efb2b10e611edb7b44259dca243ece Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 25 Aug 2009 08:56:36 +0200 Subject: [PATCH] Suppress some error messages generated after cancelling a job --- bacula/src/filed/backup.c | 36 ++++++++++++++++++++++++------------ bacula/src/stored/append.c | 16 ++++++++++------ bacula/src/stored/fd_cmds.c | 16 +++++++++------- bacula/technotes | 5 +++++ 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index f46b2c304b..820f03087b 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -846,8 +846,10 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, * */ if (!sd->fsend("%ld %d 0", jcr->JobFiles, stream)) { - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } goto err; } Dmsg1(300, ">stored: datahdr %s\n", sd->msg); @@ -1004,8 +1006,10 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, } sd->msg = wbuf; /* set correct write buffer */ if (!sd->send()) { - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } goto err; } Dmsg1(130, "Send data to SD len=%d\n", sd->msglen); @@ -1039,8 +1043,10 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, sd->msglen = encrypted_len; /* set encrypted length */ sd->msg = jcr->crypto.crypto_buf; /* set correct write buffer */ if (!sd->send()) { - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } goto err; } Dmsg1(130, "Send data to SD len=%d\n", sd->msglen); @@ -1050,8 +1056,10 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, } if (!sd->signal(BNET_EOD)) { /* indicate end of file data */ - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } goto err; } @@ -1108,8 +1116,10 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) * */ if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) { - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } return false; } Dmsg1(300, ">stored: attrhdr %s\n", sd->msg); @@ -1148,8 +1158,10 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) Dmsg2(300, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg); if (!stat) { - Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), - sd->bstrerror()); + if (!job_canceled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), + sd->bstrerror()); + } return false; } sd->signal(BNET_EOD); /* indicate end of attributes data */ diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 8fddd1fe05..be75d4f367 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -239,9 +239,11 @@ bool do_append_data(JCR *jcr) Dmsg1(650, "End read loop with FD. Stat=%d\n", n); if (ds->is_error()) { - Dmsg1(350, "Network read error from FD. ERR=%s\n", ds->bstrerror()); - Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"), - ds->bstrerror()); + if (!job_canceled(jcr)) { + Dmsg1(350, "Network read error from FD. ERR=%s\n", ds->bstrerror()); + Jmsg1(jcr, M_FATAL, 0, _("Network error on data channel. ERR=%s\n"), + ds->bstrerror()); + } ok = false; break; } @@ -289,9 +291,11 @@ bool do_append_data(JCR *jcr) Dmsg0(90, "back from write_end_session_label()\n"); /* Flush out final partial block of this session */ if (!write_block_to_device(dcr)) { - Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"), - dev->print_name(), dev->bstrerror()); - Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n")); + if (!job_canceled(jcr)) { + Jmsg2(jcr, M_FATAL, 0, _("Fatal append error on device %s: ERR=%s\n"), + dev->print_name(), dev->bstrerror()); + Dmsg0(100, _("Set ok=FALSE after write_block_to_device.\n")); + } ok = false; } if (dev->VolCatInfo.VolCatName[0] == 0) { diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 403957874b..f096e5f4a8 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -159,15 +159,17 @@ void do_fd_commands(JCR *jcr) if (strncmp(fd_cmds[i].cmd, fd->msg, strlen(fd_cmds[i].cmd)) == 0) { found = true; /* indicate command found */ jcr->errmsg[0] = 0; - if (!fd_cmds[i].func(jcr) || job_canceled(jcr)) { /* do command */ + if (!fd_cmds[i].func(jcr)) { /* do command */ /* Note fd->msg command may be destroyed by comm activity */ - if (jcr->errmsg[0]) { - Jmsg1(jcr, M_FATAL, 0, _("Command error with FD, hanging up. %s\n"), - jcr->errmsg); - } else { - Jmsg0(jcr, M_FATAL, 0, _("Command error with FD, hanging up.\n")); + if (!job_canceled(jcr)) { + if (jcr->errmsg[0]) { + Jmsg1(jcr, M_FATAL, 0, _("Command error with FD, hanging up. %s\n"), + jcr->errmsg); + } else { + Jmsg0(jcr, M_FATAL, 0, _("Command error with FD, hanging up.\n")); + } + set_jcr_job_status(jcr, JS_ErrorTerminated); } - set_jcr_job_status(jcr, JS_ErrorTerminated); quit = true; } break; diff --git a/bacula/technotes b/bacula/technotes index 856260a813..7c9fbc7ab1 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,11 @@ General: +25Aug09 +kes Suppress some error messages generated after cancelling a job. + This should reduce some of the unwanted error messages after + a job has been canceled as described in bug #1354. However, + there are many other places. 24Aug09 kes Apply and commit Lorenz Schori patch for OSX * Add platforms/osx/{build,dl,products,tools} to .gitignore -- 2.39.5