X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fwait.c;h=957e89fbc240d6106e23867642a3be201b2b7bdd;hb=a8397bfc69b83581e359e8c53b031e85ba10af2a;hp=65535d5a924ecc7e95183fa2e668cafafb52bc85;hpb=b8224aab234012c2d127b84eceb160e99dd4a14d;p=bacula%2Fbacula diff --git a/bacula/src/stored/wait.c b/bacula/src/stored/wait.c index 65535d5a92..957e89fbc2 100644 --- a/bacula/src/stored/wait.c +++ b/bacula/src/stored/wait.c @@ -112,11 +112,11 @@ int wait_for_sysop(DCR *dcr) if (now - last_heartbeat >= me->heartbeat_interval) { /* send heartbeats */ if (jcr->file_bsock) { - bnet_sig(jcr->file_bsock, BNET_HEARTBEAT); + jcr->file_bsock->signal(BNET_HEARTBEAT); Dmsg0(400, "Send heartbeat to FD.\n"); } if (jcr->dir_bsock) { - bnet_sig(jcr->dir_bsock, BNET_HEARTBEAT); + jcr->dir_bsock->signal(BNET_HEARTBEAT); } last_heartbeat = now; } @@ -124,7 +124,7 @@ int wait_for_sysop(DCR *dcr) if (stat == EINVAL) { berrno be; - Jmsg1(jcr, M_FATAL, 0, _("pthread timedwait error. ERR=%s\n"), be.strerror(stat)); + Jmsg1(jcr, M_FATAL, 0, _("pthread timedwait error. ERR=%s\n"), be.bstrerror(stat)); stat = W_ERROR; /* error */ break; } @@ -199,7 +199,7 @@ int wait_for_sysop(DCR *dcr) * Returns: true if a device has changed state * false if the total wait time has expired. */ -bool wait_for_device(JCR *jcr, bool first) +bool wait_for_device(JCR *jcr, int &retries) { struct timeval tv; struct timezone tz; @@ -207,12 +207,15 @@ bool wait_for_device(JCR *jcr, bool first) int stat = 0; bool ok = true; const int max_wait_time = 1 * 60; /* wait 1 minute */ + char ed1[50]; Dmsg0(100, "Enter wait_for_device\n"); P(device_release_mutex); - if (first) { - Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting to reserve a device.\n"), jcr->Job); + if (++retries % 5 == 0) { + /* Print message every 5 minutes */ + Jmsg(jcr, M_MOUNT, 0, _("JobId=%s, Job %s waiting to reserve a device.\n"), + edit_uint64(jcr->JobId, ed1), jcr->Job); } gettimeofday(&tv, &tz); @@ -225,7 +228,6 @@ bool wait_for_device(JCR *jcr, bool first) stat = pthread_cond_timedwait(&wait_device_release, &device_release_mutex, &timeout); Dmsg2(100, "JobId=%u wokeup from sleep on device stat=%d\n", (uint32_t)jcr->JobId, stat); - V(device_release_mutex); Dmsg2(100, "JobId=%u return from wait_device ok=%d\n", (uint32_t)jcr->JobId, ok); return ok;