}
if (!have_vol) {
+ dev->r_dlock(true);
+ block_device(dev, BST_DOING_ACQUIRE);
dev->dunlock();
- dev->dblock(BST_DOING_ACQUIRE);
Dmsg1(190, "jid=%u Do mount_next_write_vol\n", (uint32_t)jcr->JobId);
if (!dcr->mount_next_write_volume()) {
if (!job_canceled(jcr)) {
* Locking and blocking calls
*/
#ifdef SD_DEBUG_LOCK
- void _r_dlock(const char *, int); /* in lock.c */
+ void _r_dlock(const char *, int, bool locked=false); /* in lock.c */
void _r_dunlock(const char *, int); /* in lock.c */
void _dlock(const char *, int); /* in lock.c */
void _dunlock(const char *, int); /* in lock.c */
#else
- void r_dlock(); /* in lock.c */
+ void r_dlock(bool locked=false); /* in lock.c */
void r_dunlock() { dunlock(); }
void dlock() { P(m_mutex); }
void dunlock() { V(m_mutex); }
* and preparing the label.
*/
#ifdef SD_DEBUG_LOCK
-void DEVICE::_r_dlock(const char *file, int line)
+void DEVICE::_r_dlock(const char *file, int line, bool locked)
{
Dmsg3(sd_dbglvl+1, "r_dlock blked=%s from %s:%d\n", this->print_blocked(),
file, line);
#else
-void DEVICE::r_dlock()
+void DEVICE::r_dlock(bool locked)
{
#endif
int stat;
- P(m_mutex); /* this->dlock(); */
- m_count++; /* this->dlock() */
+ if (!locked) {
+ P(m_mutex); /* this->dlock(); */
+ m_count++; /* this->dlock() */
+ }
if (this->blocked() && !pthread_equal(this->no_wait_id, pthread_self())) {
this->num_waiting++; /* indicate that I am waiting */
while (this->blocked()) {