]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/1.36.2/1.36.2-reschedule.patch
Attempt to fix bug #1128 InChanger flag cleared during Migration
[bacula/bacula] / bacula / patches / 1.36.2 / 1.36.2-reschedule.patch
1  This patch should fix a Segfault bug when a job is rescheduled.
2  The storage pointers were being released when they should not
3  have been.
4
5  Apply the patch with:
6
7  patch -p0 <1.36.2-reschedule.patch
8  make
9  ...
10
11 Index: src/dird/dird.h
12 ===================================================================
13 RCS file: /cvsroot/bacula/bacula/src/dird/dird.h,v
14 retrieving revision 1.7
15 diff -u -r1.7 dird.h
16 --- src/dird/dird.h     19 Apr 2004 14:27:00 -0000      1.7
17 +++ src/dird/dird.h     18 Mar 2005 17:39:38 -0000
18 @@ -45,3 +45,4 @@
19  
20  /* From job.c */
21  void dird_free_jcr(JCR *jcr);
22 +void dird_free_jcr_pointers(JCR *jcr);
23 Index: src/dird/job.c
24 ===================================================================
25 RCS file: /cvsroot/bacula/bacula/src/dird/job.c,v
26 retrieving revision 1.92.2.2
27 diff -u -r1.92.2.2 job.c
28 --- src/dird/job.c      27 Feb 2005 21:53:28 -0000      1.92.2.2
29 +++ src/dird/job.c      18 Mar 2005 17:39:38 -0000
30 @@ -676,15 +676,9 @@
31     }
32  }
33  
34 -/*
35 - * Free the Job Control Record if no one is still using it.
36 - *  Called from main free_jcr() routine in src/lib/jcr.c so
37 - *  that we can do our Director specific cleanup of the jcr.
38 - */
39 -void dird_free_jcr(JCR *jcr)
40 +/* Called directly from job rescheduling */
41 +void dird_free_jcr_pointers(JCR *jcr)
42  {
43 -   Dmsg0(200, "Start dird free_jcr\n");
44 -
45     if (jcr->sd_auth_key) {
46        free(jcr->sd_auth_key);
47        jcr->sd_auth_key = NULL;
48 @@ -723,7 +717,21 @@
49     }
50     if (jcr->term_wait_inited) {
51        pthread_cond_destroy(&jcr->term_wait);
52 +      jcr->term_wait_inited = false;
53     }
54 +}
55 +
56 +/*
57 + * Free the Job Control Record if no one is still using it.
58 + *  Called from main free_jcr() routine in src/lib/jcr.c so
59 + *  that we can do our Director specific cleanup of the jcr.
60 + */
61 +void dird_free_jcr(JCR *jcr)
62 +{
63 +   Dmsg0(200, "Start dird free_jcr\n");
64 +
65 +   dird_free_jcr_pointers(jcr);
66 +
67     /* Delete lists setup to hold storage pointers */
68     for (int i=0; i<MAX_STORE; i++) {
69        if (jcr->storage[i]) {
70 Index: src/dird/jobq.c
71 ===================================================================
72 RCS file: /cvsroot/bacula/bacula/src/dird/jobq.c,v
73 retrieving revision 1.25.4.2
74 diff -u -r1.25.4.2 jobq.c
75 --- src/dird/jobq.c     15 Feb 2005 11:51:03 -0000      1.25.4.2
76 +++ src/dird/jobq.c     18 Mar 2005 17:39:38 -0000
77 @@ -481,7 +481,7 @@
78             bstrftime(dt, sizeof(dt), time(NULL));
79              Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds.\n"),
80                jcr->Job, dt, (int)jcr->job->RescheduleInterval);
81 -           dird_free_jcr(jcr);          /* partial cleanup old stuff */
82 +           dird_free_jcr_pointers(jcr);     /* partial cleanup old stuff */
83             jcr->JobStatus = JS_WaitStartTime;
84             jcr->SDJobStatus = 0;
85             if (jcr->JobBytes == 0) {