Bug 1508046

Summary: nfsiostat errors on 'no device mounted on /sys/kernel/debug with fstype'
Product: Red Hat Enterprise Linux 7 Reporter: Manjunath Patil <manjunath.b.patil>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: jiyin, kdsouza, manjunath.b.patil, xzhou
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-0.52.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1565071 (view as bug list) Environment:
Last Closed: 2018-04-10 18:21:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1565071    

Description Manjunath Patil 2017-10-31 18:04:01 UTC
Description of problem:
A debugfs mount could include 'No device mounted on /sys/kernel/debug with fstype debugfs' line to '/proc/self/mountstats' file. Present nfsiostat includes the "no device mounted ..." line from /proc/self/mountstats as addition description of the preceding mount point. If the preceding mount point is NFS mountpoint, nfsiostat fails to parse this line eventually.

nfsiostat fails with the below error.
#nfsiostat
:
:Traceback (most recent call last):
:  File "/usr/sbin/nfsiostat", line 634, in <module>
:    iostat_command(prog)
:  File "/usr/sbin/nfsiostat", line 587, in iostat_command
:    devices = list_nfs_mounts(origdevices, mountstats)
:  File "/usr/sbin/nfsiostat", line 490, in list_nfs_mounts
:    stats.parse_stats(descr)
:  File "/usr/sbin/nfsiostat", line 179, in parse_stats
:    self.__parse_rpc_line(words)
:  File "/usr/sbin/nfsiostat", line 163, in __parse_rpc_line
:    self.__rpc_data[op] = [long(word) for word in words[1:]]
:ValueError: invalid literal for long() with base 10: 'device'
:
:Local variables in innermost frame:
:_[1]: []
:self: <__main__.DeviceData instance at 0x128a290>
:word: 'device'
:words: ['no', 'device', 'mounted', 'on', '/sys/kernel/debug', 'with',
'fstype', 'debugfs']   >>>>>>  error.
:op: 'n' 

Version-Release number of selected component (if applicable):
nfs-utils-1.3.0-0.48.el7

How reproducible:
We can manually add the line 'No device mounted on /sys/kernel/debug with fstype debugfs' to a file along with the content of /proc/self/mountstats and make the nfsiostat read this file for parsing.

Steps to Reproduce:
1. cp /proc/self/mountstats /tmp/mountstats
2. update /usr/sbin/nfsiostat to read /tmp/mountstats 
  [change this line - (mountstats = parse_stats_file('/proc/self/mountstats')"]
3. Append 'No device mounted on /sys/kernel/debug..' below a NFS mount
4. run nfsiostat to see the above error

Actual results:
nfsiostat encounters parsing error

Expected results:
show the nfsiostat output without any parsing error

Additional info:
The following commit fixes this - 
nfs-utils]# git log -n 1 0994dc1
commit 0994dc1bb7b348b7bec30f8053841e6d22caf633
Author: Manjunath Patil <manjunath.b.patil>
Date:   Thu Oct 5 10:43:56 2017 -0400

    nfsiostat: avoid parsing "no device mounted ..." line
    
    Present nfsiostat includes the "no device mounted ..." line from
    /proc/self/mountstats as addition description of the preceding mount
    point. If the preceding mount point is NFS mountpoint, nfsiostat fails
    to parse this line eventually. This patch avoids parsing this line.
    
    Signed-off-by: Manjunath Patil <manjunath.b.patil>
    Signed-off-by: Steve Dickson <steved>

Comment 3 Yongcheng Yang 2017-11-09 09:39:14 UTC
(In reply to Manjunath Patil from comment #0)

> commit 0994dc1bb7b348b7bec30f8053841e6d22caf633
> Author: Manjunath Patil <manjunath.b.patil>
> Date:   Thu Oct 5 10:43:56 2017 -0400
> 
>     nfsiostat: avoid parsing "no device mounted ..." line

Hi Manjunath, just want to double confirm that the line (triggering
problem) heads with "no device", *NOT* with (capital) "No device".

Your above patch only handle the lowercase letter. However, there are
some uppercase (i.e. "No device ...") mentioned in the description.
I'm a bit confused as I don't know which one actually exists.
Thanks in advance!

Comment 4 Manjunath Patil 2017-11-09 18:06:28 UTC
Sorry for the confusion. Its the lower case like "no device ..."

My description wrongly included capital N as in "No device ..."

A typical entry look as follows - 
no device mounted on /sys/kernel/debug with fstype debugfs

Comment 5 Yongcheng Yang 2017-11-10 07:36:40 UTC
Thanks Manjunath for the prompt help.

Moving to VERIFIED now as nfs-utils-1.3.0-0.52.el7 has resolved this problem.

Comment 9 errata-xmlrpc 2018-04-10 18:21:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0981