From 11e4fa5c85dcadc3fbca007bcccd1b7360612bb3 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 2 Apr 2009 10:42:58 +0000 Subject: [PATCH] Enhance Job messages from SD when the FD->SD protocol is incorrect 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 | 17 +++++++++++++++++ bacula/src/version.h | 4 ++-- bacula/technotes | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 2c6a5693ee..993bf1a872 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -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 */ + jcr->errmsg[0] = 0; 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; } @@ -170,6 +178,7 @@ void do_fd_commands(JCR *jcr) } } if (!found) { /* command not found */ + Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg); Dmsg1(110, "msg); fd->fsend(ferrmsg); break; @@ -194,10 +203,12 @@ static bool append_data_cmd(JCR *jcr) 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 { + pm_strcpy(jcr->errmsg, _("Attempt to append on non-open session.\n")); fd->fsend(NOT_opened); } return false; @@ -209,6 +220,7 @@ static bool append_end_session(JCR *jcr) Dmsg1(120, "storemsg); if (!jcr->session_opened) { + pm_strcpy(jcr->errmsg, _("Attempt to close non-open session.\n")); 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) { + pm_strcpy(jcr->errmsg, _("Attempt to open already open session.\n")); fd->fsend(NO_open); return false; } @@ -250,6 +263,7 @@ static bool append_close_session(JCR *jcr) Dmsg1(120, "msg); if (!jcr->session_opened) { + pm_strcpy(jcr->errmsg, _("Attempt to close non-open session.\n")); fd->fsend(NOT_opened); return false; } @@ -278,6 +292,7 @@ static bool read_data_cmd(JCR *jcr) Dmsg1(120, "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; } @@ -295,6 +310,7 @@ static bool read_open_session(JCR *jcr) 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; } @@ -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) { + pm_strcpy(jcr->errmsg, _("Attempt to open read on non-open session.\n")); fd->fsend(NOT_opened); return false; } diff --git a/bacula/src/version.h b/bacula/src/version.h index 62f11ce50e..0bf8211ac9 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #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 */ diff --git a/bacula/technotes b/bacula/technotes index c2d31b9747..f74eb2ea5c 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -1,6 +1,9 @@ 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. -- 2.39.5