aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig <thatsafunnyname@gmail.com>2021-09-23 11:31:02 -0400
committerSteve Dickson <steved@redhat.com>2021-09-23 11:39:07 -0400
commit9d48962e8c6d807064163e2deb7360d062478502 (patch)
treed6c4d52aa964bba4a81e4eb62c5112e7c224f523
parentfeb3dfc7127cf1337530ccb06ed90e818b026a07 (diff)
downloadnfs-utils-9d48962e8c6d807064163e2deb7360d062478502.tar.gz
mountstats: division by zero error on new mount when 0==rpcsends
When rpcsends is 0 this is the error seen when mounstats is run on a NFSv4.2 mount Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=367 Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-xtools/mountstats/mountstats.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 23876fc4..8e129c83 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -482,8 +482,11 @@ class DeviceData:
count = stats[1]
if count != 0:
print('%s:' % stats[0])
+ ops_pcnt = 0
+ if sends != 0:
+ ops_pcnt = (count * 100) / sends
print('\t%d ops (%d%%)' % \
- (count, ((count * 100) / sends)), end=' ')
+ (count, ops_pcnt), end=' ')
retrans = stats[2] - count
if retrans != 0:
print('\t%d retrans (%d%%)' % (retrans, ((retrans * 100) / count)), end=' ')