From: Kern Sibbald Date: Fri, 7 Dec 2012 09:06:23 +0000 (+0100) Subject: Fix Virtual Full file close bug -- race condition X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9948138412df2b3c418e4c446c8d54ea3ea8ce07;p=bacula%2Fbacula Fix Virtual Full file close bug -- race condition --- diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index fac100785d..dc1f38bc19 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -863,7 +863,11 @@ bool mount_next_read_volume(DCR *dcr) * End Of Tape -- mount next Volume (if another specified) */ if (jcr->NumReadVolumes > 1 && jcr->CurReadVolume < jcr->NumReadVolumes) { + dev->Lock(); dev->close(); + dev->set_read(); + dcr->set_reserved(); + dev->Unlock(); if (!acquire_device_for_read(dcr)) { Jmsg2(jcr, M_FATAL, 0, _("Cannot open Dev=%s, Vol=%s\n"), dev->print_name(), dcr->VolumeName);