Bug 625080 - nfsstat: has_stats() does not function correctly for NFSv4 client stats
Summary: nfsstat: has_stats() does not function correctly for NFSv4 client stats
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: nfs-utils
Version: 6.0
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 6.1
Assignee: Steve Dickson
QA Contact: yanfu,wang
URL:
Whiteboard:
Depends On:
Blocks: 580566 627601
TreeView+ depends on / blocked
 
Reported: 2010-08-18 14:46 UTC by Harshula Jayasuriya
Modified: 2018-11-14 19:13 UTC (History)
5 users (show)

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.
Clone Of:
Environment:
Last Closed: 2011-05-19 14:16:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
nfs-utils-nfsstat-fix-CLTPROC4-and-manpage.patch (1.04 KB, patch)
2010-08-18 14:57 UTC, Harshula Jayasuriya
no flags Details | Diff
nfs-utils-nfsstat-fix-has_stats-and-manpage.patch (8.91 KB, patch)
2010-11-09 17:34 UTC, Harshula Jayasuriya
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0738 0 normal SHIPPED_LIVE nfs-utils bug fix and enhancement update 2011-05-18 18:09:16 UTC

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


Note You need to log in before you can comment on or make changes to this bug.