static const char *spool_name = "*spool*";
+/*
+ * NB! This routine locks the device, but if committing will
+ * not unlock it. If not committing, it will be unlocked.
+ */
static bool despool_data(DCR *dcr, bool commit)
{
DEVICE *rdev;
char ec1[50];
Dmsg0(100, "Despooling data\n");
- /* Commit means that the job is done, so we commit, otherwise, we
+ /*
+ * Commit means that the job is done, so we commit, otherwise, we
* are despooling because of user spool size max or some error
* (e.g. filesystem full).
*/
}
dcr->despool_wait = true;
dcr->spooling = false;
- lock_device(dcr->dev);
+ dcr->dev->r_dlock();
dcr->despool_wait = false;
dcr->despooling = true;
dcr->dev_locked = true;
rdev->max_block_size = dcr->dev->max_block_size;
rdev->min_block_size = dcr->dev->min_block_size;
rdev->device = dcr->dev->device;
- rdcr = new_dcr(NULL, rdev);
+ rdcr = new_dcr(jcr, rdev);
rdcr->spool_fd = dcr->spool_fd;
rdcr->jcr = jcr; /* set a valid jcr */
block = dcr->block; /* save block */
/* If doing a commit, leave the device locked -- unlocked in release_device() */
if (!commit) {
dcr->dev_locked = false;
- unlock_device(dcr->dev);
+ dcr->dev->dunlock();
}
return ok;
}