From: Kern Sibbald Date: Tue, 19 May 2009 16:38:37 +0000 (+0000) Subject: During jcr destruction hold jcr_chaing lock only for minimum X-Git-Tag: Release-3.0.2~225 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ffcf8951cd956a49645ae2845f9b0397b84e6f02;p=bacula%2Fbacula During jcr destruction hold jcr_chaing lock only for minimum 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 --- diff --git a/bacula/patches/3.0.1-sd-hang.patch b/bacula/patches/3.0.1-sd-hang.patch new file mode 100644 index 0000000000..74029c64ae --- /dev/null +++ b/bacula/patches/3.0.1-sd-hang.patch @@ -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 + patch -p0 <3.0.1-sd-hang.patch + ./configure + 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(); diff --git a/bacula/src/lib/jcr.c b/bacula/src/lib/jcr.c index 32b6aabd3b..4da6de29da 100644 --- a/bacula/src/lib/jcr.c +++ b/bacula/src/lib/jcr.c @@ -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(); diff --git a/bacula/technotes b/bacula/technotes index 5f793fc026..9d40a64e8b 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -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.