Print this page
nfssrv: nfsstat reports zeroed data in zone

@@ -193,13 +193,10 @@
 static void     nfs_srv_shutdown_all(int);
 static void     rfs4_server_start(nfs_globals_t *, int);
 static void     nullfree(void);
 static void     rfs_dispatch(struct svc_req *, SVCXPRT *);
 static void     acl_dispatch(struct svc_req *, SVCXPRT *);
-static void     common_dispatch(struct svc_req *, SVCXPRT *,
-                rpcvers_t, rpcvers_t, char *,
-                struct rpc_disptable *);
 static  int     checkauth(struct exportinfo *, struct svc_req *, cred_t *, int,
                 bool_t, bool_t *);
 static char     *client_name(struct svc_req *req);
 static char     *client_addr(struct svc_req *req, char *buf);
 extern  int     sec_svc_getcred(struct svc_req *, cred_t *cr, char **, int *);

@@ -1332,17 +1329,17 @@
 };
 
 static struct rpc_disptable rfs_disptable[] = {
         {sizeof (rfsdisptab_v2) / sizeof (rfsdisptab_v2[0]),
             rfscallnames_v2,
-            &rfsproccnt_v2_ptr, rfsdisptab_v2},
+            rfsdisptab_v2},
         {sizeof (rfsdisptab_v3) / sizeof (rfsdisptab_v3[0]),
             rfscallnames_v3,
-            &rfsproccnt_v3_ptr, rfsdisptab_v3},
+            rfsdisptab_v3},
         {sizeof (rfsdisptab_v4) / sizeof (rfsdisptab_v4[0]),
             rfscallnames_v4,
-            &rfsproccnt_v4_ptr, rfsdisptab_v4},
+            rfsdisptab_v4},
 };
 
 /*
  * If nfs_portmon is set, then clients are required to use privileged
  * ports (ports < IPPORT_RESERVED) in order to get NFS services.

@@ -1460,11 +1457,10 @@
                         return (TRUE);
         }
         return (FALSE);
 }
 
-
 static void
 common_dispatch(struct svc_req *req, SVCXPRT *xprt, rpcvers_t min_vers,
     rpcvers_t max_vers, char *pgmname, struct rpc_disptable *disptable)
 {
         int which;

@@ -1497,13 +1493,21 @@
         struct exportinfo *nfslog_exi = NULL;
         char **procnames;
         char cbuf[INET6_ADDRSTRLEN];    /* to hold both IPv4 and IPv6 addr */
         bool_t ro = FALSE;
         nfs_export_t *ne = nfs_get_export();
+        nfs_globals_t *ng = ne->ne_globals;
+        kstat_named_t *svstat, *procstat;
 
+        ASSERT(req->rq_prog == NFS_PROGRAM || req->rq_prog == NFS_ACL_PROGRAM);
+
         vers = req->rq_vers;
 
+        svstat = ng->svstat[req->rq_vers];
+        procstat = (req->rq_prog == NFS_PROGRAM) ?
+            ng->rfsproccnt[vers] : ng->aclproccnt[vers];
+
         if (vers < min_vers || vers > max_vers) {
                 svcerr_progvers(req->rq_xprt, min_vers, max_vers);
                 error++;
                 cmn_err(CE_NOTE, "%s: bad version number %u", pgmname, vers);
                 goto done;

@@ -1515,11 +1519,11 @@
                 svcerr_noproc(req->rq_xprt);
                 error++;
                 goto done;
         }
 
-        (*(disptable[(int)vers].dis_proccntp))[which].value.ui64++;
+        procstat[which].value.ui64++;
 
         disp = &disptable[(int)vers].dis_table[which];
         procnames = disptable[(int)vers].dis_procnames;
 
         auth_flavor = req->rq_cred.oa_flavor;

@@ -1837,13 +1841,12 @@
         }
 
         if (exi != NULL)
                 exi_rele(exi);
 
-        global_svstat_ptr[req->rq_vers][NFS_BADCALLS].value.ui64 += error;
-
-        global_svstat_ptr[req->rq_vers][NFS_CALLS].value.ui64++;
+        svstat[NFS_BADCALLS].value.ui64 += error;
+        svstat[NFS_CALLS].value.ui64++;
 }
 
 static void
 rfs_dispatch(struct svc_req *req, SVCXPRT *xprt)
 {

@@ -1962,14 +1965,14 @@
 };
 
 static struct rpc_disptable acl_disptable[] = {
         {sizeof (acldisptab_v2) / sizeof (acldisptab_v2[0]),
                 aclcallnames_v2,
-                &aclproccnt_v2_ptr, acldisptab_v2},
+                acldisptab_v2},
         {sizeof (acldisptab_v3) / sizeof (acldisptab_v3[0]),
                 aclcallnames_v3,
-                &aclproccnt_v3_ptr, acldisptab_v3},
+                acldisptab_v3},
 };
 
 static void
 acl_dispatch(struct svc_req *req, SVCXPRT *xprt)
 {

@@ -2647,10 +2650,11 @@
         /*
          * Order here is important.
          * export init must precede srv init calls.
          */
         nfs_export_zone_init(ng);
+        rfs_stat_zone_init(ng);
         rfs_srv_zone_init(ng);
         rfs3_srv_zone_init(ng);
         rfs4_srv_zone_init(ng);
         nfsauth_zone_init(ng);
 

@@ -2695,10 +2699,11 @@
          */
         nfsauth_zone_fini(ng);
         rfs4_srv_zone_fini(ng);
         rfs3_srv_zone_fini(ng);
         rfs_srv_zone_fini(ng);
+        rfs_stat_zone_fini(ng);
         nfs_export_zone_fini(ng);
 
         mutex_destroy(&ng->nfs_server_upordown_lock);
         cv_destroy(&ng->nfs_server_upordown_cv);
         mutex_destroy(&ng->rdma_wait_mutex);