Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 625080

Summary: nfsstat: has_stats() does not function correctly for NFSv4 client stats
Product: Red Hat Enterprise Linux 6 Reporter: Harshula Jayasuriya <harshula>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: yanfu,wang <yanwang>
Severity: low Docs Contact:
Priority: low    
Version: 6.0CC: moshiro, myamazak, skito, syeghiay, tao
Target Milestone: rcKeywords: RHELNAK
Target Release: 6.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nfs-utils-1.2.3-4.el6 Doc Type: Bug Fix
Doc Text:
The "nfsstat --nfs" command did not return any results for NFS version 4 clients because the has_stats() function did not support statistics for the NFS version 4 clients. This update adapts the underlying code and the command returns the values as expected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 14:16:39 UTC Type: ---
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: 580566, 627601    
Attachments:
Description Flags
nfs-utils-nfsstat-fix-CLTPROC4-and-manpage.patch
none
nfs-utils-nfsstat-fix-has_stats-and-manpage.patch none

Description Harshula Jayasuriya 2010-08-18 14:46:59 UTC
Description of problem:

1) CLTPROC4_SZ should be 42 not 48

# uname -r
2.6.32-37.el6.x86_64
# grep proc4 /proc/net/rpc/nfs | wc
      1      44      93
# grep proc4ops /proc/net/rpc/nfsd | wc
      1      61     131

utils/nfsstat/nfsstat.c:
------------------------------------------------------------
  28 enum {
  29         SRVPROC2_SZ = 18,
  30         CLTPROC2_SZ = 18,
  31         SRVPROC3_SZ = 22,
  32         CLTPROC3_SZ = 22,
  33         SRVPROC4_SZ = 2,
  34         CLTPROC4_SZ = 48,
  35         SRVPROC4OPS_SZ = 59,
  36 };
...
  48 static unsigned int     cltproc4info[CLTPROC4_SZ+2],
  49                         cltproc4info_old[CLTPROC4_SZ+2];        /* NFSv4 ca     ll counts ([0] == 48) */
  50 static unsigned int     srvproc4opsinfo[SRVPROC4OPS_SZ+2],
  51                         srvproc4opsinfo_old[SRVPROC4OPS_SZ+2];  /* NFSv4 ca     ll counts ([0] == 59) */
------------------------------------------------------------

include/linux/nfs4.h:
------------------------------------------------------------
  1         NFSPROC4_CLNT_NULL = 0,         /* Unused */
  2         NFSPROC4_CLNT_READ,
  3         NFSPROC4_CLNT_WRITE,
  4         NFSPROC4_CLNT_COMMIT,
  5         NFSPROC4_CLNT_OPEN,
  6         NFSPROC4_CLNT_OPEN_CONFIRM,
  7         NFSPROC4_CLNT_OPEN_NOATTR,
  8         NFSPROC4_CLNT_OPEN_DOWNGRADE,
  9         NFSPROC4_CLNT_CLOSE,
 10         NFSPROC4_CLNT_SETATTR,
 11         NFSPROC4_CLNT_FSINFO,
 12         NFSPROC4_CLNT_RENEW,
 13         NFSPROC4_CLNT_SETCLIENTID,
 14         NFSPROC4_CLNT_SETCLIENTID_CONFIRM,
 15         NFSPROC4_CLNT_LOCK,
 16         NFSPROC4_CLNT_LOCKT,
 17         NFSPROC4_CLNT_LOCKU,
 18         NFSPROC4_CLNT_ACCESS,
 19         NFSPROC4_CLNT_GETATTR,
 20         NFSPROC4_CLNT_LOOKUP,
 21         NFSPROC4_CLNT_LOOKUP_ROOT,
 22         NFSPROC4_CLNT_REMOVE,
 23         NFSPROC4_CLNT_RENAME,
 24         NFSPROC4_CLNT_LINK,
 25         NFSPROC4_CLNT_SYMLINK,
 26         NFSPROC4_CLNT_CREATE,
 27         NFSPROC4_CLNT_PATHCONF,
 28         NFSPROC4_CLNT_STATFS,
 29         NFSPROC4_CLNT_READLINK,
 30         NFSPROC4_CLNT_READDIR,
 31         NFSPROC4_CLNT_SERVER_CAPS,
 32         NFSPROC4_CLNT_DELEGRETURN,
 33         NFSPROC4_CLNT_GETACL,
 34         NFSPROC4_CLNT_SETACL,
 35         NFSPROC4_CLNT_FS_LOCATIONS,
 36         NFSPROC4_CLNT_RELEASE_LOCKOWNER,
 37         NFSPROC4_CLNT_EXCHANGE_ID,
 38         NFSPROC4_CLNT_CREATE_SESSION,
 39         NFSPROC4_CLNT_DESTROY_SESSION,
 40         NFSPROC4_CLNT_SEQUENCE,
 41         NFSPROC4_CLNT_GET_LEASE_TIME,
 42         NFSPROC4_CLNT_RECLAIM_COMPLETE,
------------------------------------------------------------

2) The nfsstat man page doesn't describe the option -3 and -4 completely.

A RHEL 5.x Bug 437242 modified nfsstat man page which did not make it into upstream nfs-utils nor RHEL 6.x nfs-utils. Namely:
------------------------------------------------------------
       -2     Print only NFS v2 statistics.  The  default  is  to  only  print
              information about the versions of NFS that have non-zero counts.

       -3     Print only NFS v3 statistics.  The  default  is  to  only  print
              information about the versions of NFS that have non-zero counts.

       -4     Print only NFS v4 statistics.  The  default  is  to  only  print
              information about the versions of NFS that have non-zero counts.
------------------------------------------------------------

Version-Release number of selected component (if applicable):
* nfs-utils-1.2.2-4.el6.x86_64.rpm
* kernel-2.6.32-37.el6.x86_64.rpm

How reproducible: Always

Steps to Reproduce:
1. Mount an NFSv4 export
2. Run: nfsstat --nfs

Actual results:
# nfsstat --nfs

Expected results:
# nfsstat --nfs
Client nfs v4:
null         read         write        commit       open         open_conf    
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
open_noat    open_dgrd    close        setattr      fsinfo       renew        
0         0% 0         0% 0         0% 0         0% 2        25% 0         0% 
setclntid    confirm      lock         lockt        locku        access       
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
getattr      lookup       lookup_root  remove       rename       link         
1        12% 0         0% 1        12% 0         0% 0         0% 0         0% 
symlink      create       pathconf     statfs       readlink     readdir      
0         0% 0         0% 1        12% 0         0% 0         0% 0         0% 
server_caps  delegreturn  getacl       setacl       fs_locations exchange_id  
3        37% 0         0% 0         0% 0         0% 0         0% 0         0% 
create_ses   destroy_ses  sequence     get_lease_t  reclaim_comp layoutget    
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 

Regards,
Harshula

Comment 1 Harshula Jayasuriya 2010-08-18 14:57:13 UTC
Created attachment 439405 [details]
nfs-utils-nfsstat-fix-CLTPROC4-and-manpage.patch

Comment 4 RHEL Program Management 2010-08-18 15:18:35 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 5 Steve Dickson 2010-09-13 15:48:54 UTC
Fixed by:

commit 7f77ef90ad52eced1552efc2242e063aa4501ddc
Author: Benny Halevy <bhalevy>
Date:   Tue Jul 20 08:40:34 2010 +0300

    nfsstat: add release_lockowner to client stats
    
    Signed-off-by: Benny Halevy <bhalevy>

Comment 6 Harshula Jayasuriya 2010-09-13 18:45:21 UTC
Hi,

commit 7f77ef90ad52eced1552efc2242e063aa4501ddc does not fix this bug.

nfs-utils has to be kept in sync with the kernel's number of procs/ops in "struct rpc_procinfo nfs4_procedures" because it is used to generate the stats interface:
------------------------------------------------------------
# cat /proc/net/rpc/nfs 
net 0 0 0 0
rpc 15 0 0
proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
proc3 22 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0
proc4 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
------------------------------------------------------------
Note, for proc4, the number 42. That is the number of stats that follow on the same line.

We need to decide whether CLTPROC4_SZ, in nfs-utils, represents the number of procs/ops in "struct rpc_procinfo nfs4_procedures" or not. If we agree that it should, then we need to lower CLTPROC4_SZ from 48 to 42. If not, then we need to change cltproc4info[CLTPROC4_SZ+2] to cltproc4info[44].

I need to respin the original patch because I forgot to modify nfscltproc4name. So either way, I will need to update the patch.

Regards,
Harshula

Comment 7 Harshula Jayasuriya 2010-09-13 18:56:28 UTC
NOTE: "struct rpc_procinfo nfs4_procedures" does not contain the NULL PROC. So to be completely accurate, it is the number of procs/ops in "struct rpc_procinfo nfs4_procedures" + 1. :-)

Comment 8 Harshula Jayasuriya 2010-11-09 17:32:36 UTC
This ended up being more convoluted than expected because different kernel versions, exposing a different number of NFSv4 client OPs, need to work with nfs-utils. The fix for upstream nfs-utils needs to be generalised.

Comment 9 Harshula Jayasuriya 2010-11-09 17:34:20 UTC
Created attachment 459197 [details]
nfs-utils-nfsstat-fix-has_stats-and-manpage.patch

Comment 16 yanfu,wang 2011-03-15 05:41:24 UTC
verified on i386 and x86_64:
[root@hp-dl360g5-02 ~]# uname -a
Linux hp-dl360g5-02.rhts.eng.bos.redhat.com 2.6.32-118.el6.x86_64 #1 SMP Tue Feb 22 11:15:55 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@hp-dl360g5-02 ~]# rpm -qa|grep nfs-utils
nfs-utils-1.2.3-4.el6.x86_64
nfs-utils-lib-1.1.5-3.el6.x86_64

[root@hp-dl360g5-02 ~]# nfsstat --nfs
Server nfs v4:
null         compound     
3        15% 16       84% 

Server nfs v4 operations:
op0-unused   op1-unused   op2-future   access       close        commit       
0         0% 0         0% 0         0% 1         2% 0         0% 0         0% 
create       delegpurge   delegreturn  getattr      getfh        link         
0         0% 0         0% 0         0% 16       42% 3         7% 0         0% 
lock         lockt        locku        lookup       lookup_root  nverify      
0         0% 0         0% 0         0% 2         5% 0         0% 0         0% 
open         openattr     open_conf    open_dgrd    putfh        putpubfh     
0         0% 0         0% 0         0% 0         0% 15       39% 0         0% 
putrootfh    read         readdir      readlink     remove       rename       
1         2% 0         0% 0         0% 0         0% 0         0% 0         0% 
renew        restorefh    savefh       secinfo      setattr      setcltid     
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
setcltidconf verify       write        rellockowner bc_ctl       bind_conn    
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
exchange_id  create_ses   destroy_ses  free_stateid getdirdeleg  getdevinfo   
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
getdevlist   layoutcommit layoutget    layoutreturn secinfononam sequence     
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
set_ssv      test_stateid want_deleg   destroy_clid reclaim_comp 
0         0% 0         0% 0         0% 0         0% 0         0% 

Client nfs v4:
null         read         write        commit       open         open_conf    
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
open_noat    open_dgrd    close        setattr      fsinfo       renew        
0         0% 0         0% 0         0% 0         0% 3        16% 0         0% 
setclntid    confirm      lock         lockt        locku        access       
0         0% 0         0% 0         0% 0         0% 0         0% 1         5% 
getattr      lookup       lookup_root  remove       rename       link         
2        11% 2        11% 3        16% 0         0% 0         0% 0         0% 
symlink      create       pathconf     statfs       readlink     readdir      
0         0% 0         0% 2        11% 0         0% 0         0% 0         0% 
server_caps  delegreturn  getacl       setacl       fs_locations rel_lkowner  
5        27% 0         0% 0         0% 0         0% 0         0% 0         0% 
exchange_id  create_ses   destroy_ses  sequence     get_lease_t  reclaim_comp 
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
layoutget    layoutcommit layoutreturn getdevlist   getdevinfo   ds_write     
0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 
ds_commit    
0         0% 

[root@hp-dl360g5-02 ~]# man nfsstat
...
       -2     Print  only  NFS  v2  statistics. The default is to only print information about the versions of NFS that have
              non-zero counts.

       -3     Print only NFS v3 statistics. The default is to only print information about the versions  of  NFS  that  have
              non-zero counts.

       -4     Print  only  NFS  v4  statistics. The default is to only print information about the versions of NFS that have
              non-zero counts.

Comment 17 Eva Kopalova 2011-05-12 15:41:57 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The "nfsstat --nfs" command did not return any results for NFS version 4 clients because the has_stats() function did not support statistics for the NFS version 4 clients. This update adapts the underlying code and the command returns the values as expected.

Comment 18 errata-xmlrpc 2011-05-19 14:16:39 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0738.html