Skip to content

Commit

Permalink
tapestat: Fix issue when st driver is unloaded then loaded again
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Sebastien GODARD <[email protected]>
  • Loading branch information
sysstat committed Aug 26, 2015
1 parent 370c5c1 commit 9062673
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tapestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 9062673

Please sign in to comment.