ebl Take care of bad clock changes while computing VolWriteTime
and VolReadTime. This should fix or limit #1066
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6781
91ce42f0-d328-0410-95d8-
f526ca767f89
UPDATE_DB(jcr, mdb, mdb->cmd);
}
+ /* sanity checks for #1066 */
+ if (mr->VolReadTime < 0) {
+ mr->VolReadTime = 0;
+ }
+ if (mr->VolWriteTime < 0) {
+ mr->VolWriteTime = 0;
+ }
+
Mmsg(mdb->cmd, "UPDATE Media SET VolJobs=%u,"
"VolFiles=%u,VolBlocks=%u,VolBytes=%s,VolMounts=%u,VolErrors=%u,"
"VolWrites=%u,MaxVolBytes=%s,VolStatus='%s',"
mr.VolWrites = sdmr.VolWrites;
mr.Slot = sdmr.Slot;
mr.InChanger = sdmr.InChanger;
- mr.VolReadTime = sdmr.VolReadTime;
- mr.VolWriteTime = sdmr.VolWriteTime;
mr.VolParts = sdmr.VolParts;
bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
+ if (sdmr.VolReadTime >= 0) {
+ mr.VolReadTime = sdmr.VolReadTime;
+ }
+ if (sdmr.VolWriteTime >= 0) {
+ mr.VolWriteTime = sdmr.VolWriteTime;
+ }
/*
* Update to point to the last device used to write the Volume.
* However, do so only if we are writing the tape, i.e.
}
}
-/* return the last timer interval (ms) */
+/* return the last timer interval (ms)
+ * or 0 if something goes wrong
+ */
btime_t DEVICE::get_timer_count()
{
- btime_t old = last_timer;
+ btime_t temp = last_timer;
last_timer = get_current_btime();
- return last_timer - old;
+ temp = last_timer - temp; /* get elapsed time */
+ return (temp>0)?temp:0; /* take care of skewed clock */
}
/* read from fd */
General:
09Apr08
+ebl Add sanity checks for VolWriteTime and VolReadTime
+ebl Take care of bad clock changes while computing VolWriteTime
+ and VolReadTime. This should fix or limit #1066
kes Correct error string numbers in dird/catreq.c
kes Restructure reserving, acquiring, and mounting volumes. Calls to
autochanger are deferred for mount.c -- simplifes the code.