int reservations_lock_count = 0;
/* This applies to a drive and to Volumes */
-void _lock_reservations()
+void _lock_reservations(const char *file, int line)
{
int errstat;
reservations_lock_count++;
- if ((errstat=rwl_writelock(&reservation_lock)) != 0) {
+ if ((errstat=rwl_writelock_p(&reservation_lock, file, line)) != 0) {
berrno be;
Emsg2(M_ABORT, 0, "rwl_writelock failure. stat=%d: ERR=%s\n",
errstat, be.bstrerror(errstat));
*/
void DCR::unreserve_device()
{
+ dev->dlock();
lock_volumes();
if (is_reserved()) {
clear_reserved();
}
}
unlock_volumes();
+ dev->dunlock();
}
/*
rctx.suitable_device = true;
Dmsg1(dbglvl, "try reserve %s\n", rctx.device->hdr.name);
- rctx.jcr->dcr = dcr = new_dcr(rctx.jcr, rctx.jcr->dcr, rctx.device->dev);
+ if (rctx.store->append) {
+ dcr = new_dcr(rctx.jcr, rctx.jcr->dcr, rctx.device->dev);
+ } else {
+ dcr = new_dcr(rctx.jcr, rctx.jcr->read_dcr, rctx.device->dev);
+ }
if (!dcr) {
BSOCK *dir = rctx.jcr->dir_bsock;
dir->fsend(_("3926 Could not get dcr for device: %s\n"), rctx.device_name);
dev->dlock();
- if (is_device_unmounted(dev)) {
+ if (dev->is_device_unmounted()) {
Dmsg1(dbglvl, "Device %s is BLOCKED due to user unmount.\n", dev->print_name());
Mmsg(jcr->errmsg, _("3601 JobId=%u device %s is BLOCKED due to user unmount.\n"),
jcr->JobId, dev->print_name());
}
/* If device is unmounted, we are out of luck */
- if (is_device_unmounted(dev)) {
+ if (dev->is_device_unmounted()) {
Mmsg(jcr->errmsg, _("3604 JobId=%u device %s is BLOCKED due to user unmount.\n"),
jcr->JobId, dev->print_name());
Dmsg1(dbglvl, "%s", jcr->errmsg);