1 Index: src/dird/backup.c
2 ===================================================================
3 --- src/dird/backup.c (révision 5819)
4 +++ src/dird/backup.c (copie de travail)
6 set_jcr_job_status(jcr, JS_ErrorTerminated);
7 Dmsg1(400, "wait for sd. use=%d\n", jcr->use_count());
9 - cancel_storage_daemon_job(jcr);
10 - wait_for_storage_daemon_termination(jcr);
11 + wait_for_job_termination(jcr, 300);
12 Dmsg1(400, "after wait for sd. use=%d\n", jcr->use_count());
16 * are done, we return the job status.
17 * Also used by restore.c
19 -int wait_for_job_termination(JCR *jcr)
20 +int wait_for_job_termination(JCR *jcr, int timeout)
23 BSOCK *fd = jcr->file_bsock;
25 uint64_t JobBytes = 0;
30 set_jcr_job_status(jcr, JS_Running);
33 + tid = start_bsock_timer(fd, timeout); /* TODO: use user timeout */
35 /* Wait for Client to terminate */
36 while ((n = bget_dirmsg(fd)) >= 0) {
43 + stop_bsock_timer(tid);
46 if (is_bnet_error(fd)) {
47 Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
48 Index: src/dird/protos.h
49 ===================================================================
50 --- src/dird/protos.h (révision 5819)
51 +++ src/dird/protos.h (copie de travail)
53 extern bool find_recycled_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr);
56 -extern int wait_for_job_termination(JCR *jcr);
57 +extern int wait_for_job_termination(JCR *jcr, int timeout=0);
58 extern bool do_backup_init(JCR *jcr);
59 extern bool do_backup(JCR *jcr);
60 extern void backup_cleanup(JCR *jcr, int TermCode);
61 Index: src/filed/job.c
62 ===================================================================
63 --- src/filed/job.c (révision 5856)
64 +++ src/filed/job.c (copie de travail)
66 /* Run the after job */
67 run_scripts(jcr, jcr->RunScripts, "ClientAfterJob");
70 + char ed1[50], ed2[50];
71 + /* Send termination status back to Dir */
72 + bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
73 + edit_uint64(jcr->ReadBytes, ed1),
74 + edit_uint64(jcr->JobBytes, ed2), jcr->Errors, jcr->VSS,
76 + Dmsg1(110, "End FD msg: %s\n", dir->msg);
79 generate_daemon_event(jcr, "JobEnd");
81 dequeue_messages(jcr); /* send any queued messages */
82 @@ -1331,15 +1341,13 @@
83 BSOCK *sd = jcr->store_bsock;
86 - char ed1[50], ed2[50];
87 - bool bDoVSS = false;
89 #if defined(WIN32_VSS)
90 // capture state here, if client is backed up by multiple directors
91 // and one enables vss and the other does not then enable_vss can change
92 // between here and where its evaluated after the job completes.
93 - bDoVSS = g_pVSSClient && enable_vss;
95 + jcr->VSS = g_pVSSClient && enable_vss;
97 /* Run only one at a time */
100 @@ -1395,7 +1403,7 @@
102 #if defined(WIN32_VSS)
103 /* START VSS ON WIN 32 */
106 if (g_pVSSClient->InitializeForBackup()) {
107 /* tell vss which drives to snapshot */
108 char szWinDriveLetters[27];
109 @@ -1488,7 +1496,7 @@
110 #if defined(WIN32_VSS)
111 /* STOP VSS ON WIN 32 */
112 /* tell vss to close the backup session */
115 if (g_pVSSClient->CloseBackup()) {
116 /* inform user about writer states */
117 for (int i=0; i<(int)g_pVSSClient->GetWriterCount(); i++) {
118 @@ -1504,12 +1512,6 @@
122 - bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
123 - edit_uint64(jcr->ReadBytes, ed1),
124 - edit_uint64(jcr->JobBytes, ed2), jcr->Errors, (int)bDoVSS,
126 - Dmsg1(110, "End FD msg: %s\n", dir->msg);
128 return 0; /* return and stop command loop */
131 @@ -1521,7 +1523,7 @@
133 BSOCK *dir = jcr->dir_bsock;
134 BSOCK *sd = jcr->store_bsock;
135 - char level[100], ed1[50], ed2[50];
138 jcr->JobType = JT_VERIFY;
139 if (sscanf(dir->msg, verifycmd, level) != 1) {
140 @@ -1585,15 +1587,6 @@
142 bnet_sig(dir, BNET_EOD);
144 - /* Send termination status back to Dir */
145 - bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
146 - edit_uint64(jcr->ReadBytes, ed1),
147 - edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
149 - Dmsg1(110, "End FD msg: %s\n", dir->msg);
151 - /* Inform Director that we are done */
152 - bnet_sig(dir, BNET_TERMINATE);
153 return 0; /* return and terminate command loop */
156 @@ -1609,7 +1602,6 @@
157 bool use_regexwhere=false;
160 - char ed1[50], ed2[50];
163 * Scan WHERE (base directory for restore) from command
164 @@ -1696,16 +1688,7 @@
166 set_jcr_job_status(jcr, JS_ErrorTerminated);
168 - /* Send termination status back to Dir */
169 - bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles,
170 - edit_uint64(jcr->ReadBytes, ed1),
171 - edit_uint64(jcr->JobBytes, ed2), jcr->Errors, 0,
173 - Dmsg1(110, "End FD msg: %s\n", dir->msg);
175 - /* Inform Director that we are done */
176 - bnet_sig(dir, BNET_TERMINATE);
178 Dmsg0(130, "Done in job.c\n");
179 return 0; /* return and terminate command loop */
182 ===================================================================
183 --- src/jcr.h (révision 5856)
184 +++ src/jcr.h (copie de travail)
186 int32_t pki_session_encoded_size; /* Size of DER-encoded pki_session */
187 POOLMEM *crypto_buf; /* Encryption/Decryption buffer */
188 DIRRES* director; /* Director resource */
189 + bool VSS; /* VSS used by FD */
190 #endif /* FILE_DAEMON */