]> granicus.if.org Git - sysstat/commitdiff
tapestat: Fix issue when st driver is unloaded then loaded again
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 26 Aug 2015 19:07:59 +0000 (21:07 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 26 Aug 2015 19:07:59 +0000 (21:07 +0200)
tapestat didn't look for the stats dropping back to zero when the st
driver is unloaded then loaded again, so you get one really line of
really large values when that happens. Fix this problem by
adding a check to see if the new stats are less than the old ones and
marking any tape where that happens as having invalid stats. The
information for that drive will disappear until we have all valid stats
again (it's the test for read_time, write_time, and other_time)
The test is only needed for those three since if any of them are less than
the previously read stats someone has unloaded and reloaded the driver
since that's the only time they can reduce in value).

Signed-off-by: Shane M. SEYMOUR <shane.seymour@hp.com>
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
tapestat.c

index ac3d8e2b3a281ce577ab21752453bb47535c4981..e6505d91edde4a192c46f727a5dfbece8f7ebb78 100644 (file)
@@ -335,6 +335,12 @@ void tape_get_updated_stats(void)
                TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "write_cnt", write_count)
                TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "other_cnt", other_count)
                TAPE_STAT_FILE_VAL(TAPE_STAT_PATH "resid_cnt", resid_count)
+
+               if ((tape_new_stats[i].read_time < tape_old_stats[i].read_time) ||
+                   (tape_new_stats[i].write_time < tape_old_stats[i].write_time) ||
+                   (tape_new_stats[i].other_time < tape_old_stats[i].other_time)) {
+                       tape_new_stats[i].valid = TAPE_STATS_INVALID;
+               }
        }
 }