]> git.sur5r.net Git - bacula/bacula/commitdiff
Enhance Job messages from SD when the FD->SD protocol is incorrect
authorKern Sibbald <kern@sibbald.com>
Thu, 2 Apr 2009 10:42:58 +0000 (10:42 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 2 Apr 2009 10:42:58 +0000 (10:42 +0000)
     and the SD hangs up. Previously this looked like a comm error.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8680 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/fd_cmds.c
bacula/src/version.h
bacula/technotes

index 2c6a5693eeadc1e538e83ba5400a240632e07e2f..993bf1a8720b37863a7c0e994398640db87fef5f 100644 (file)
@@ -162,7 +162,15 @@ void do_fd_commands(JCR *jcr)
       for (i=0; fd_cmds[i].cmd; i++) {
          if (strncmp(fd_cmds[i].cmd, fd->msg, strlen(fd_cmds[i].cmd)) == 0) {
             found = true;               /* indicate command found */
       for (i=0; fd_cmds[i].cmd; i++) {
          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) || job_canceled(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"));
+               }
                set_jcr_job_status(jcr, JS_ErrorTerminated);
                quit = true;
             }
                set_jcr_job_status(jcr, JS_ErrorTerminated);
                quit = true;
             }
@@ -170,6 +178,7 @@ void do_fd_commands(JCR *jcr)
          }
       }
       if (!found) {                   /* command not found */
          }
       }
       if (!found) {                   /* command not found */
+         Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg);
          Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
          fd->fsend(ferrmsg);
          break;
          Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
          fd->fsend(ferrmsg);
          break;
@@ -194,10 +203,12 @@ static bool append_data_cmd(JCR *jcr)
       if (do_append_data(jcr)) {
          return true;
       } else {
       if (do_append_data(jcr)) {
          return true;
       } else {
+         pm_strcpy(jcr->errmsg, _("Append data error.\n"));
          bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
          fd->fsend(ERROR_append);
       }
    } else {
          bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
          fd->fsend(ERROR_append);
       }
    } else {
+      pm_strcpy(jcr->errmsg, _("Attempt to append on non-open session.\n"));
       fd->fsend(NOT_opened);
    }
    return false;
       fd->fsend(NOT_opened);
    }
    return false;
@@ -209,6 +220,7 @@ static bool append_end_session(JCR *jcr)
 
    Dmsg1(120, "store<file: %s", fd->msg);
    if (!jcr->session_opened) {
 
    Dmsg1(120, "store<file: %s", fd->msg);
    if (!jcr->session_opened) {
+      pm_strcpy(jcr->errmsg, _("Attempt to close non-open session.\n"));
       fd->fsend(NOT_opened);
       return false;
    }
       fd->fsend(NOT_opened);
       return false;
    }
@@ -226,6 +238,7 @@ static bool append_open_session(JCR *jcr)
 
    Dmsg1(120, "Append open session: %s", fd->msg);
    if (jcr->session_opened) {
 
    Dmsg1(120, "Append open session: %s", fd->msg);
    if (jcr->session_opened) {
+      pm_strcpy(jcr->errmsg, _("Attempt to open already open session.\n"));
       fd->fsend(NO_open);
       return false;
    }
       fd->fsend(NO_open);
       return false;
    }
@@ -250,6 +263,7 @@ static bool append_close_session(JCR *jcr)
 
    Dmsg1(120, "<filed: %s", fd->msg);
    if (!jcr->session_opened) {
 
    Dmsg1(120, "<filed: %s", fd->msg);
    if (!jcr->session_opened) {
+      pm_strcpy(jcr->errmsg, _("Attempt to close non-open session.\n"));
       fd->fsend(NOT_opened);
       return false;
    }
       fd->fsend(NOT_opened);
       return false;
    }
@@ -278,6 +292,7 @@ static bool read_data_cmd(JCR *jcr)
       Dmsg1(120, "<bfiled: %s", fd->msg);
       return do_read_data(jcr);
    } else {
       Dmsg1(120, "<bfiled: %s", fd->msg);
       return do_read_data(jcr);
    } else {
+      pm_strcpy(jcr->errmsg, _("Attempt to read on non-open session.\n"));
       fd->fsend(NOT_opened);
       return false;
    }
       fd->fsend(NOT_opened);
       return false;
    }
@@ -295,6 +310,7 @@ static bool read_open_session(JCR *jcr)
 
    Dmsg1(120, "%s\n", fd->msg);
    if (jcr->session_opened) {
 
    Dmsg1(120, "%s\n", fd->msg);
    if (jcr->session_opened) {
+      pm_strcpy(jcr->errmsg, _("Attempt to open read on non-open session.\n"));
       fd->fsend(NO_open);
       return false;
    }
       fd->fsend(NO_open);
       return false;
    }
@@ -303,6 +319,7 @@ static bool read_open_session(JCR *jcr)
          &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
          &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
       if (jcr->session_opened) {
          &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
          &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
       if (jcr->session_opened) {
+         pm_strcpy(jcr->errmsg, _("Attempt to open read on non-open session.\n"));
          fd->fsend(NOT_opened);
          return false;
       }
          fd->fsend(NOT_opened);
          return false;
       }
index 62f11ce50e4a17c2d0ff670b47981cba0fb3c7ea..0bf8211ac9b00b3242eba5f05ef495c1ce48460b 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.5.44"
 
 #undef  VERSION
 #define VERSION "2.5.44"
-#define BDATE   "31 March 2009"
-#define LSMDATE "31Mar09"
+#define BDATE   "04 April 2009"
+#define LSMDATE "04Apr09"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2009"       /* year for copyright messages in progs */
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2009"       /* year for copyright messages in progs */
index c2d31b9747c136b34902b123b550e8514751cebc..f74eb2ea5c2398f4d787cbce2e4e88a817ad0aad 100644 (file)
@@ -1,6 +1,9 @@
               Technical notes for current SVN
           
 General:
               Technical notes for current SVN
           
 General:
+04Apr09
+kes  Enhance Job messages from SD when the FD->SD protocol is incorrect
+     and the SD hangs up. Previously this looked like a comm error.
 02Apr09
 mvw  Fixed problem in xattr and acl code trying to send empty acl or xattr
      streams.
 02Apr09
 mvw  Fixed problem in xattr and acl code trying to send empty acl or xattr
      streams.