]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix #1695 about bacula-sd crash in detach_dcr_from_dev()
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 14 Feb 2011 14:38:19 +0000 (15:38 +0100)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 14 Feb 2011 14:41:31 +0000 (15:41 +0100)
bacula/src/stored/acquire.c

index 5cb8949638eda591ccbd0fd41a199d4c541ac883..146aa4530c7ebdee36f4558d05668ffc41cfc1e6 100644 (file)
@@ -682,8 +682,11 @@ static void attach_dcr_to_dev(DCR *dcr)
    dev = dcr->dev;
    jcr = dcr->jcr;
    if (jcr) Dmsg1(500, "JobId=%u enter attach_dcr_to_dev\n", (uint32_t)jcr->JobId);
+   /* ***FIXME*** return error if dev not initiated */
    if (!dcr->attached_to_dev && dev->initiated && jcr && jcr->getJobType() != JT_SYSTEM) {
+      dev->dlock();
       dev->attached_dcrs->append(dcr);  /* attach dcr to device */
+      dev->dunlock();
       dcr->attached_to_dev = true;
       Dmsg1(500, "JobId=%u attach_dcr_to_dev\n", (uint32_t)jcr->JobId);
    }