]> git.sur5r.net Git - bacula/bacula/commitdiff
During jcr destruction hold jcr_chaing lock only for minimum
authorKern Sibbald <kern@sibbald.com>
Tue, 19 May 2009 16:38:37 +0000 (16:38 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 19 May 2009 16:38:37 +0000 (16:38 +0000)
     time necessary.  This should fix the SD deadlock in bug #1287.

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

bacula/patches/3.0.1-sd-hang.patch [new file with mode: 0644]
bacula/src/lib/jcr.c
bacula/technotes

diff --git a/bacula/patches/3.0.1-sd-hang.patch b/bacula/patches/3.0.1-sd-hang.patch
new file mode 100644 (file)
index 0000000..74029c6
--- /dev/null
@@ -0,0 +1,36 @@
+
+ This patch can be applied to version 3.0.1 and fixes a 
+ a race condition that causes the SD to hang. This should
+ fix bug #1287.
+
+ Apply it to version 3.0.1 with:
+
+ cd <bacula-source>
+ patch -p0 <3.0.1-sd-hang.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/lib/jcr.c
+===================================================================
+--- src/lib/jcr.c      (revision 8840)
++++ src/lib/jcr.c      (working copy)
+@@ -518,6 +518,7 @@
+             jcr->JobId, jcr->use_count(), jcr->Job);
+    }
+    remove_jcr(jcr);                   /* remove Jcr from chain */
++   unlock_jcr_chain();
+    dequeue_messages(jcr);
+    job_end_pop(jcr);                  /* pop and call hooked routines */
+@@ -571,7 +572,6 @@
+       jcr->daemon_free_jcr(jcr);      /* call daemon free routine */
+    }
+-   unlock_jcr_chain();
+    free_common_jcr(jcr);
+    close_msg(NULL);                   /* flush any daemon messages */
+    garbage_collect_memory_pool();
index 32b6aabd3baa3d4f481c5f66b592bce879b5470a..4da6de29da6272bb2efff624f12db213e358e21a 100644 (file)
@@ -518,6 +518,7 @@ void free_jcr(JCR *jcr)
             jcr->JobId, jcr->use_count(), jcr->Job);
    }
    remove_jcr(jcr);                   /* remove Jcr from chain */
+   unlock_jcr_chain();
 
    dequeue_messages(jcr);
    job_end_pop(jcr);                  /* pop and call hooked routines */
@@ -571,7 +572,6 @@ void free_jcr(JCR *jcr)
       jcr->daemon_free_jcr(jcr);      /* call daemon free routine */
    }
 
-   unlock_jcr_chain();
    free_common_jcr(jcr);
    close_msg(NULL);                   /* flush any daemon messages */
    garbage_collect_memory_pool();
index 5f793fc026b915d3854316b98982b9d5d55931a7..9d40a64e8bec38419d6ea47fdac3bd6729c965ce 100644 (file)
@@ -2,6 +2,9 @@
           
 General:
 
+19May09
+kes  During jcr destruction hold jcr_chaing lock only for minimum
+     time necessary.  This should fix the SD deadlock in bug #1287.
 18May09
 kes  Simplify messages printed by SD when reserve fails. This
      should fix bug #1285.