Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs3_srv.c
          +++ new/usr/src/uts/common/fs/nfs/nfs3_srv.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       23 + * Copyright 2018 Nexenta Systems, Inc.
  24   24   * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  25   25   * Copyright (c) 2013 by Delphix. All rights reserved.
  26   26   */
  27   27  
  28   28  /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
  29   29  /* All Rights Reserved */
  30   30  
       31 +
  31   32  #include <sys/param.h>
  32   33  #include <sys/types.h>
  33   34  #include <sys/systm.h>
  34   35  #include <sys/cred.h>
  35   36  #include <sys/buf.h>
  36   37  #include <sys/vfs.h>
  37   38  #include <sys/vnode.h>
  38   39  #include <sys/uio.h>
  39   40  #include <sys/errno.h>
  40   41  #include <sys/sysmacros.h>
↓ open down ↓ 20 lines elided ↑ open up ↑
  61   62  #include <sys/strsubr.h>
  62   63  #include <sys/tsol/label.h>
  63   64  #include <sys/tsol/tndb.h>
  64   65  
  65   66  #include <sys/zone.h>
  66   67  
  67   68  #include <inet/ip.h>
  68   69  #include <inet/ip6.h>
  69   70  
  70   71  /*
       72 + * Zone global variables of NFSv3 server
       73 + */
       74 +typedef struct nfs3_srv {
       75 +        writeverf3      write3verf;
       76 +} nfs3_srv_t;
       77 +
       78 +/*
  71   79   * These are the interface routines for the server side of the
  72   80   * Network File System.  See the NFS version 3 protocol specification
  73   81   * for a description of this interface.
  74   82   */
  75   83  
  76      -static writeverf3 write3verf;
  77      -
  78   84  static int      sattr3_to_vattr(sattr3 *, struct vattr *);
  79   85  static int      vattr_to_fattr3(struct vattr *, fattr3 *);
  80   86  static int      vattr_to_wcc_attr(struct vattr *, wcc_attr *);
  81   87  static void     vattr_to_pre_op_attr(struct vattr *, pre_op_attr *);
  82   88  static void     vattr_to_wcc_data(struct vattr *, struct vattr *, wcc_data *);
  83   89  static int      rdma_setup_read_data3(READ3args *, READ3resok *);
  84   90  
  85   91  extern int nfs_loaned_buffers;
  86   92  
  87   93  u_longlong_t nfs3_srv_caller_id;
  88   94  
       95 +static nfs3_srv_t *
       96 +nfs3_get_srv(void)
       97 +{
       98 +        nfs_globals_t *ng = nfs_srv_getzg();
       99 +        nfs3_srv_t *srv = ng->nfs3_srv;
      100 +        ASSERT(srv != NULL);
      101 +        return (srv);
      102 +}
      103 +
  89  104  /* ARGSUSED */
  90  105  void
  91  106  rfs3_getattr(GETATTR3args *args, GETATTR3res *resp, struct exportinfo *exi,
  92  107      struct svc_req *req, cred_t *cr, bool_t ro)
  93  108  {
  94  109          int error;
  95  110          vnode_t *vp;
  96  111          struct vattr va;
  97  112  
  98  113          vp = nfs3_fhtovp(&args->object, exi);
  99  114  
 100      -        DTRACE_NFSV3_4(op__getattr__start, struct svc_req *, req,
 101      -            cred_t *, cr, vnode_t *, vp, GETATTR3args *, args);
      115 +        DTRACE_NFSV3_5(op__getattr__start, struct svc_req *, req,
      116 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      117 +            GETATTR3args *, args);
 102  118  
 103  119          if (vp == NULL) {
 104  120                  error = ESTALE;
 105  121                  goto out;
 106  122          }
 107  123  
 108  124          va.va_mask = AT_ALL;
 109  125          error = rfs4_delegated_getattr(vp, &va, 0, cr);
 110  126  
 111  127          if (!error) {
 112  128                  /* Lie about the object type for a referral */
 113  129                  if (vn_is_nfs_reparse(vp, cr))
 114  130                          va.va_type = VLNK;
 115  131  
 116  132                  /* overflow error if time or size is out of range */
 117  133                  error = vattr_to_fattr3(&va, &resp->resok.obj_attributes);
 118  134                  if (error)
 119  135                          goto out;
 120  136                  resp->status = NFS3_OK;
 121  137  
 122      -                DTRACE_NFSV3_4(op__getattr__done, struct svc_req *, req,
 123      -                    cred_t *, cr, vnode_t *, vp, GETATTR3res *, resp);
      138 +                DTRACE_NFSV3_5(op__getattr__done, struct svc_req *, req,
      139 +                    cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      140 +                    GETATTR3res *, resp);
 124  141  
 125  142                  VN_RELE(vp);
 126  143  
 127  144                  return;
 128  145          }
 129  146  
 130  147  out:
 131  148          if (curthread->t_flag & T_WOULDBLOCK) {
 132  149                  curthread->t_flag &= ~T_WOULDBLOCK;
 133  150                  resp->status = NFS3ERR_JUKEBOX;
 134  151          } else
 135  152                  resp->status = puterrno3(error);
 136  153  
 137      -        DTRACE_NFSV3_4(op__getattr__done, struct svc_req *, req,
 138      -            cred_t *, cr, vnode_t *, vp, GETATTR3res *, resp);
      154 +        DTRACE_NFSV3_5(op__getattr__done, struct svc_req *, req,
      155 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      156 +            GETATTR3res *, resp);
 139  157  
 140  158          if (vp != NULL)
 141  159                  VN_RELE(vp);
 142  160  }
 143  161  
 144  162  void *
 145  163  rfs3_getattr_getfh(GETATTR3args *args)
 146  164  {
 147  165  
 148  166          return (&args->object);
↓ open down ↓ 12 lines elided ↑ open up ↑
 161  179          int flag;
 162  180          int in_crit = 0;
 163  181          struct flock64 bf;
 164  182          caller_context_t ct;
 165  183  
 166  184          bvap = NULL;
 167  185          avap = NULL;
 168  186  
 169  187          vp = nfs3_fhtovp(&args->object, exi);
 170  188  
 171      -        DTRACE_NFSV3_4(op__setattr__start, struct svc_req *, req,
 172      -            cred_t *, cr, vnode_t *, vp, SETATTR3args *, args);
      189 +        DTRACE_NFSV3_5(op__setattr__start, struct svc_req *, req,
      190 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      191 +            SETATTR3args *, args);
 173  192  
 174  193          if (vp == NULL) {
 175  194                  error = ESTALE;
 176  195                  goto out;
 177  196          }
 178  197  
 179  198          error = sattr3_to_vattr(&args->new_attributes, &ava);
 180  199          if (error)
 181  200                  goto out;
 182  201  
↓ open down ↓ 140 lines elided ↑ open up ↑
 323  342  
 324  343          if (error)
 325  344                  goto out;
 326  345  
 327  346          if (in_crit)
 328  347                  nbl_end_crit(vp);
 329  348  
 330  349          resp->status = NFS3_OK;
 331  350          vattr_to_wcc_data(bvap, avap, &resp->resok.obj_wcc);
 332  351  
 333      -        DTRACE_NFSV3_4(op__setattr__done, struct svc_req *, req,
 334      -            cred_t *, cr, vnode_t *, vp, SETATTR3res *, resp);
      352 +        DTRACE_NFSV3_5(op__setattr__done, struct svc_req *, req,
      353 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      354 +            SETATTR3res *, resp);
 335  355  
 336  356          VN_RELE(vp);
 337  357  
 338  358          return;
 339  359  
 340  360  out:
 341  361          if (curthread->t_flag & T_WOULDBLOCK) {
 342  362                  curthread->t_flag &= ~T_WOULDBLOCK;
 343  363                  resp->status = NFS3ERR_JUKEBOX;
 344  364          } else
 345  365                  resp->status = puterrno3(error);
 346  366  out1:
 347      -        DTRACE_NFSV3_4(op__setattr__done, struct svc_req *, req,
 348      -            cred_t *, cr, vnode_t *, vp, SETATTR3res *, resp);
      367 +        DTRACE_NFSV3_5(op__setattr__done, struct svc_req *, req,
      368 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      369 +            SETATTR3res *, resp);
 349  370  
 350  371          if (vp != NULL) {
 351  372                  if (in_crit)
 352  373                          nbl_end_crit(vp);
 353  374                  VN_RELE(vp);
 354  375          }
 355  376          vattr_to_wcc_data(bvap, avap, &resp->resfail.obj_wcc);
 356  377  }
 357  378  
 358  379  void *
↓ open down ↓ 24 lines elided ↑ open up ↑
 383  404          dvap = NULL;
 384  405  
 385  406          if (exi != NULL)
 386  407                  exi_hold(exi);
 387  408  
 388  409          /*
 389  410           * Allow lookups from the root - the default
 390  411           * location of the public filehandle.
 391  412           */
 392  413          if (exi != NULL && (exi->exi_export.ex_flags & EX_PUBLIC)) {
 393      -                dvp = rootdir;
      414 +                ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
      415 +                dvp = ZONE_ROOTVP();
 394  416                  VN_HOLD(dvp);
 395  417  
 396      -                DTRACE_NFSV3_4(op__lookup__start, struct svc_req *, req,
 397      -                    cred_t *, cr, vnode_t *, dvp, LOOKUP3args *, args);
      418 +                DTRACE_NFSV3_5(op__lookup__start, struct svc_req *, req,
      419 +                    cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
      420 +                    LOOKUP3args *, args);
 398  421          } else {
 399  422                  dvp = nfs3_fhtovp(&args->what.dir, exi);
 400  423  
 401      -                DTRACE_NFSV3_4(op__lookup__start, struct svc_req *, req,
 402      -                    cred_t *, cr, vnode_t *, dvp, LOOKUP3args *, args);
      424 +                DTRACE_NFSV3_5(op__lookup__start, struct svc_req *, req,
      425 +                    cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
      426 +                    LOOKUP3args *, args);
 403  427  
 404  428                  if (dvp == NULL) {
 405  429                          error = ESTALE;
 406  430                          goto out;
 407  431                  }
 408  432          }
 409  433  
 410  434          dva.va_mask = AT_ALL;
 411  435          dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 412  436  
↓ open down ↓ 1 lines elided ↑ open up ↑
 414  438                  resp->status = NFS3ERR_NAMETOOLONG;
 415  439                  goto out1;
 416  440          }
 417  441  
 418  442          if (args->what.name == NULL || *(args->what.name) == '\0') {
 419  443                  resp->status = NFS3ERR_ACCES;
 420  444                  goto out1;
 421  445          }
 422  446  
 423  447          fhp = &args->what.dir;
      448 +        ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL */
 424  449          if (strcmp(args->what.name, "..") == 0 &&
 425  450              EQFID(&exi->exi_fid, FH3TOFIDP(fhp))) {
 426  451                  if ((exi->exi_export.ex_flags & EX_NOHIDE) &&
 427      -                    (dvp->v_flag & VROOT)) {
      452 +                    ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp))) {
 428  453                          /*
 429  454                           * special case for ".." and 'nohide'exported root
 430  455                           */
 431  456                          if (rfs_climb_crossmnt(&dvp, &exi, cr) != 0) {
 432  457                                  resp->status = NFS3ERR_ACCES;
 433  458                                  goto out1;
 434  459                          }
 435  460                  } else {
 436  461                          resp->status = NFS3ERR_NOENT;
 437  462                          goto out1;
↓ open down ↓ 10 lines elided ↑ open up ↑
 448  473          }
 449  474  
 450  475          /*
 451  476           * If the public filehandle is used then allow
 452  477           * a multi-component lookup
 453  478           */
 454  479          if (PUBLIC_FH3(&args->what.dir)) {
 455  480                  publicfh_flag = TRUE;
 456  481  
 457  482                  exi_rele(exi);
      483 +                exi = NULL;
 458  484  
 459  485                  error = rfs_publicfh_mclookup(name, dvp, cr, &vp,
 460  486                      &exi, &sec);
 461  487  
 462  488                  /*
 463  489                   * Since WebNFS may bypass MOUNT, we need to ensure this
 464  490                   * request didn't come from an unlabeled admin_low client.
 465  491                   */
 466  492                  if (is_system_labeled() && error == 0) {
 467  493                          int             addr_type;
↓ open down ↓ 63 lines elided ↑ open up ↑
 531  557          }
 532  558  
 533  559          if (error) {
 534  560                  VN_RELE(vp);
 535  561                  goto out;
 536  562          }
 537  563  
 538  564          va.va_mask = AT_ALL;
 539  565          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 540  566  
 541      -        exi_rele(exi);
 542  567          VN_RELE(vp);
 543  568  
 544  569          resp->status = NFS3_OK;
 545  570          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 546  571          vattr_to_post_op_attr(dvap, &resp->resok.dir_attributes);
 547  572  
 548  573          /*
 549  574           * If it's public fh, no 0x81, and client's flavor is
 550  575           * invalid, set WebNFS status to WNFSERR_CLNT_FLAVOR now.
 551  576           * Then set RPC status to AUTH_TOOWEAK in common_dispatch.
 552  577           */
 553  578          if (auth_weak)
 554  579                  resp->status = (enum nfsstat3)WNFSERR_CLNT_FLAVOR;
 555  580  
 556      -        DTRACE_NFSV3_4(op__lookup__done, struct svc_req *, req,
 557      -            cred_t *, cr, vnode_t *, dvp, LOOKUP3res *, resp);
      581 +        DTRACE_NFSV3_5(op__lookup__done, struct svc_req *, req,
      582 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
      583 +            LOOKUP3res *, resp);
 558  584          VN_RELE(dvp);
      585 +        exi_rele(exi);
 559  586  
 560  587          return;
 561  588  
 562  589  out:
 563  590          if (curthread->t_flag & T_WOULDBLOCK) {
 564  591                  curthread->t_flag &= ~T_WOULDBLOCK;
 565  592                  resp->status = NFS3ERR_JUKEBOX;
 566  593          } else
 567  594                  resp->status = puterrno3(error);
 568  595  out1:
      596 +        DTRACE_NFSV3_5(op__lookup__done, struct svc_req *, req,
      597 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
      598 +            LOOKUP3res *, resp);
      599 +
 569  600          if (exi != NULL)
 570  601                  exi_rele(exi);
 571  602  
 572      -        DTRACE_NFSV3_4(op__lookup__done, struct svc_req *, req,
 573      -            cred_t *, cr, vnode_t *, dvp, LOOKUP3res *, resp);
 574      -
 575  603          if (dvp != NULL)
 576  604                  VN_RELE(dvp);
 577  605          vattr_to_post_op_attr(dvap, &resp->resfail.dir_attributes);
 578  606  
 579  607  }
 580  608  
 581  609  void *
 582  610  rfs3_lookup_getfh(LOOKUP3args *args)
 583  611  {
 584  612  
↓ open down ↓ 11 lines elided ↑ open up ↑
 596  624          struct vattr va;
 597  625          int checkwriteperm;
 598  626          boolean_t dominant_label = B_FALSE;
 599  627          boolean_t equal_label = B_FALSE;
 600  628          boolean_t admin_low_client;
 601  629  
 602  630          vap = NULL;
 603  631  
 604  632          vp = nfs3_fhtovp(&args->object, exi);
 605  633  
 606      -        DTRACE_NFSV3_4(op__access__start, struct svc_req *, req,
 607      -            cred_t *, cr, vnode_t *, vp, ACCESS3args *, args);
      634 +        DTRACE_NFSV3_5(op__access__start, struct svc_req *, req,
      635 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      636 +            ACCESS3args *, args);
 608  637  
 609  638          if (vp == NULL) {
 610  639                  error = ESTALE;
 611  640                  goto out;
 612  641          }
 613  642  
 614  643          /*
 615  644           * If the file system is exported read only, it is not appropriate
 616  645           * to check write permissions for regular files and directories.
 617  646           * Special files are interpreted by the client, so the underlying
↓ open down ↓ 89 lines elided ↑ open up ↑
 707  736                      dominant_label))
 708  737                          resp->resok.access |= ACCESS3_EXECUTE;
 709  738          }
 710  739  
 711  740          va.va_mask = AT_ALL;
 712  741          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 713  742  
 714  743          resp->status = NFS3_OK;
 715  744          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 716  745  
 717      -        DTRACE_NFSV3_4(op__access__done, struct svc_req *, req,
 718      -            cred_t *, cr, vnode_t *, vp, ACCESS3res *, resp);
      746 +        DTRACE_NFSV3_5(op__access__done, struct svc_req *, req,
      747 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      748 +            ACCESS3res *, resp);
 719  749  
 720  750          VN_RELE(vp);
 721  751  
 722  752          return;
 723  753  
 724  754  out:
 725  755          if (curthread->t_flag & T_WOULDBLOCK) {
 726  756                  curthread->t_flag &= ~T_WOULDBLOCK;
 727  757                  resp->status = NFS3ERR_JUKEBOX;
 728  758          } else
 729  759                  resp->status = puterrno3(error);
 730      -        DTRACE_NFSV3_4(op__access__done, struct svc_req *, req,
 731      -            cred_t *, cr, vnode_t *, vp, ACCESS3res *, resp);
      760 +        DTRACE_NFSV3_5(op__access__done, struct svc_req *, req,
      761 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      762 +            ACCESS3res *, resp);
 732  763          if (vp != NULL)
 733  764                  VN_RELE(vp);
 734  765          vattr_to_post_op_attr(vap, &resp->resfail.obj_attributes);
 735  766  }
 736  767  
 737  768  void *
 738  769  rfs3_access_getfh(ACCESS3args *args)
 739  770  {
 740  771  
 741  772          return (&args->object);
↓ open down ↓ 12 lines elided ↑ open up ↑
 754  785          struct uio uio;
 755  786          char *data;
 756  787          struct sockaddr *ca;
 757  788          char *name = NULL;
 758  789          int is_referral = 0;
 759  790  
 760  791          vap = NULL;
 761  792  
 762  793          vp = nfs3_fhtovp(&args->symlink, exi);
 763  794  
 764      -        DTRACE_NFSV3_4(op__readlink__start, struct svc_req *, req,
 765      -            cred_t *, cr, vnode_t *, vp, READLINK3args *, args);
      795 +        DTRACE_NFSV3_5(op__readlink__start, struct svc_req *, req,
      796 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      797 +            READLINK3args *, args);
 766  798  
 767  799          if (vp == NULL) {
 768  800                  error = ESTALE;
 769  801                  goto out;
 770  802          }
 771  803  
 772  804          va.va_mask = AT_ALL;
 773  805          error = VOP_GETATTR(vp, &va, 0, cr, NULL);
 774  806          if (error)
 775  807                  goto out;
↓ open down ↓ 28 lines elided ↑ open up ↑
 804  836                                  goto out1;
 805  837                          }
 806  838                  }
 807  839          }
 808  840  
 809  841          data = kmem_alloc(MAXPATHLEN + 1, KM_SLEEP);
 810  842  
 811  843          if (is_referral) {
 812  844                  char *s;
 813  845                  size_t strsz;
      846 +                kstat_named_t *stat = exi->exi_ne->ne_globals->svstat[NFS_V3];
 814  847  
 815  848                  /* Get an artificial symlink based on a referral */
 816  849                  s = build_symlink(vp, cr, &strsz);
 817      -                global_svstat_ptr[3][NFS_REFERLINKS].value.ui64++;
      850 +                stat[NFS_REFERLINKS].value.ui64++;
 818  851                  DTRACE_PROBE2(nfs3serv__func__referral__reflink,
 819  852                      vnode_t *, vp, char *, s);
 820  853                  if (s == NULL)
 821  854                          error = EINVAL;
 822  855                  else {
 823  856                          error = 0;
 824  857                          (void) strlcpy(data, s, MAXPATHLEN + 1);
 825  858                          kmem_free(s, strsz);
 826  859                  }
 827  860  
↓ open down ↓ 47 lines elided ↑ open up ↑
 875  908                   * Even though the conversion failed, we return
 876  909                   * something. We just don't translate it.
 877  910                   */
 878  911                  name = data;
 879  912          }
 880  913  
 881  914          resp->status = NFS3_OK;
 882  915          vattr_to_post_op_attr(vap, &resp->resok.symlink_attributes);
 883  916          resp->resok.data = name;
 884  917  
 885      -        DTRACE_NFSV3_4(op__readlink__done, struct svc_req *, req,
 886      -            cred_t *, cr, vnode_t *, vp, READLINK3res *, resp);
      918 +        DTRACE_NFSV3_5(op__readlink__done, struct svc_req *, req,
      919 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      920 +            READLINK3res *, resp);
 887  921          VN_RELE(vp);
 888  922  
 889  923          if (name != data)
 890  924                  kmem_free(data, MAXPATHLEN + 1);
 891  925  
 892  926          return;
 893  927  
 894  928  out:
 895  929          if (curthread->t_flag & T_WOULDBLOCK) {
 896  930                  curthread->t_flag &= ~T_WOULDBLOCK;
 897  931                  resp->status = NFS3ERR_JUKEBOX;
 898  932          } else
 899  933                  resp->status = puterrno3(error);
 900  934  out1:
 901      -        DTRACE_NFSV3_4(op__readlink__done, struct svc_req *, req,
 902      -            cred_t *, cr, vnode_t *, vp, READLINK3res *, resp);
      935 +        DTRACE_NFSV3_5(op__readlink__done, struct svc_req *, req,
      936 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      937 +            READLINK3res *, resp);
 903  938          if (vp != NULL)
 904  939                  VN_RELE(vp);
 905  940          vattr_to_post_op_attr(vap, &resp->resfail.symlink_attributes);
 906  941  }
 907  942  
 908  943  void *
 909  944  rfs3_readlink_getfh(READLINK3args *args)
 910  945  {
 911  946  
 912  947          return (&args->symlink);
↓ open down ↓ 29 lines elided ↑ open up ↑
 942  977          int need_rwunlock = 0;
 943  978          caller_context_t ct;
 944  979          int rdma_used = 0;
 945  980          int loaned_buffers;
 946  981          struct uio *uiop;
 947  982  
 948  983          vap = NULL;
 949  984  
 950  985          vp = nfs3_fhtovp(&args->file, exi);
 951  986  
 952      -        DTRACE_NFSV3_4(op__read__start, struct svc_req *, req,
 953      -            cred_t *, cr, vnode_t *, vp, READ3args *, args);
      987 +        DTRACE_NFSV3_5(op__read__start, struct svc_req *, req,
      988 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
      989 +            READ3args *, args);
 954  990  
      991 +
 955  992          if (vp == NULL) {
 956  993                  error = ESTALE;
 957  994                  goto out;
 958  995          }
 959  996  
 960  997          if (args->wlist) {
 961  998                  if (args->count > clist_len(args->wlist)) {
 962  999                          error = EINVAL;
 963 1000                          goto out;
 964 1001                  }
↓ open down ↓ 233 lines elided ↑ open up ↑
1198 1235                  resp->resok.data.data_val = (caddr_t)iov.iov_base;
1199 1236                  if (!rdma_setup_read_data3(args, &(resp->resok))) {
1200 1237                          resp->status = NFS3ERR_INVAL;
1201 1238                  }
1202 1239          } else {
1203 1240                  resp->resok.data.data_val = (caddr_t)mp->b_datap->db_base;
1204 1241                  (resp->resok).wlist = NULL;
1205 1242          }
1206 1243  
1207 1244  done:
1208      -        DTRACE_NFSV3_4(op__read__done, struct svc_req *, req,
1209      -            cred_t *, cr, vnode_t *, vp, READ3res *, resp);
     1245 +        DTRACE_NFSV3_5(op__read__done, struct svc_req *, req,
     1246 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     1247 +            READ3res *, resp);
1210 1248  
1211 1249          VN_RELE(vp);
1212 1250  
1213 1251          if (iovp != NULL)
1214 1252                  kmem_free(iovp, iovcnt * sizeof (struct iovec));
1215 1253  
1216 1254          return;
1217 1255  
1218 1256  out:
1219 1257          if (curthread->t_flag & T_WOULDBLOCK) {
1220 1258                  curthread->t_flag &= ~T_WOULDBLOCK;
1221 1259                  resp->status = NFS3ERR_JUKEBOX;
1222 1260          } else
1223 1261                  resp->status = puterrno3(error);
1224 1262  out1:
1225      -        DTRACE_NFSV3_4(op__read__done, struct svc_req *, req,
1226      -            cred_t *, cr, vnode_t *, vp, READ3res *, resp);
     1263 +        DTRACE_NFSV3_5(op__read__done, struct svc_req *, req,
     1264 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     1265 +            READ3res *, resp);
1227 1266  
1228 1267          if (vp != NULL) {
1229 1268                  if (need_rwunlock)
1230 1269                          VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, &ct);
1231 1270                  if (in_crit)
1232 1271                          nbl_end_crit(vp);
1233 1272                  VN_RELE(vp);
1234 1273          }
1235 1274          vattr_to_post_op_attr(vap, &resp->resfail.file_attributes);
1236 1275  
↓ open down ↓ 24 lines elided ↑ open up ↑
1261 1300  
1262 1301  #ifdef DEBUG
1263 1302  static int rfs3_write_hits = 0;
1264 1303  static int rfs3_write_misses = 0;
1265 1304  #endif
1266 1305  
1267 1306  void
1268 1307  rfs3_write(WRITE3args *args, WRITE3res *resp, struct exportinfo *exi,
1269 1308      struct svc_req *req, cred_t *cr, bool_t ro)
1270 1309  {
     1310 +        nfs3_srv_t *ns;
1271 1311          int error;
1272 1312          vnode_t *vp;
1273 1313          struct vattr *bvap = NULL;
1274 1314          struct vattr bva;
1275 1315          struct vattr *avap = NULL;
1276 1316          struct vattr ava;
1277 1317          u_offset_t rlimit;
1278 1318          struct uio uio;
1279 1319          struct iovec iov[MAX_IOVECS];
1280 1320          mblk_t *m;
1281 1321          struct iovec *iovp;
1282 1322          int iovcnt;
1283 1323          int ioflag;
1284 1324          cred_t *savecred;
1285 1325          int in_crit = 0;
1286 1326          int rwlock_ret = -1;
1287 1327          caller_context_t ct;
1288 1328  
1289 1329          vp = nfs3_fhtovp(&args->file, exi);
1290 1330  
1291      -        DTRACE_NFSV3_4(op__write__start, struct svc_req *, req,
1292      -            cred_t *, cr, vnode_t *, vp, WRITE3args *, args);
     1331 +        DTRACE_NFSV3_5(op__write__start, struct svc_req *, req,
     1332 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     1333 +            WRITE3args *, args);
1293 1334  
1294 1335          if (vp == NULL) {
1295 1336                  error = ESTALE;
1296 1337                  goto err;
1297 1338          }
1298 1339  
     1340 +        ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL. */
     1341 +        ns = nfs3_get_srv();
     1342 +
1299 1343          if (is_system_labeled()) {
1300 1344                  bslabel_t *clabel = req->rq_label;
1301 1345  
1302 1346                  ASSERT(clabel != NULL);
1303 1347                  DTRACE_PROBE2(tx__rfs3__log__info__opwrite__clabel, char *,
1304 1348                      "got client label from request(1)", struct svc_req *, req);
1305 1349  
1306 1350                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
1307 1351                          if (!do_rfs_label_check(clabel, vp, EQUALITY_CHECK,
1308 1352                              exi)) {
↓ open down ↓ 67 lines elided ↑ open up ↑
1376 1420          if (MANDLOCK(vp, bva.va_mode)) {
1377 1421                  resp->status = NFS3ERR_ACCES;
1378 1422                  goto err1;
1379 1423          }
1380 1424  
1381 1425          if (args->count == 0) {
1382 1426                  resp->status = NFS3_OK;
1383 1427                  vattr_to_wcc_data(bvap, avap, &resp->resok.file_wcc);
1384 1428                  resp->resok.count = 0;
1385 1429                  resp->resok.committed = args->stable;
1386      -                resp->resok.verf = write3verf;
     1430 +                resp->resok.verf = ns->write3verf;
1387 1431                  goto out;
1388 1432          }
1389 1433  
1390 1434          if (args->mblk != NULL) {
1391 1435                  iovcnt = 0;
1392 1436                  for (m = args->mblk; m != NULL; m = m->b_cont)
1393 1437                          iovcnt++;
1394 1438                  if (iovcnt <= MAX_IOVECS) {
1395 1439  #ifdef DEBUG
1396 1440                          rfs3_write_hits++;
↓ open down ↓ 81 lines elided ↑ open up ↑
1478 1522                      bvap->va_seq == 0 || avap->va_seq == 0 ||
1479 1523                      avap->va_seq != (bvap->va_seq + 1)) {
1480 1524                          bvap = NULL;
1481 1525                  }
1482 1526          }
1483 1527  
1484 1528          resp->status = NFS3_OK;
1485 1529          vattr_to_wcc_data(bvap, avap, &resp->resok.file_wcc);
1486 1530          resp->resok.count = args->count - uio.uio_resid;
1487 1531          resp->resok.committed = args->stable;
1488      -        resp->resok.verf = write3verf;
     1532 +        resp->resok.verf = ns->write3verf;
1489 1533          goto out;
1490 1534  
1491 1535  err:
1492 1536          if (curthread->t_flag & T_WOULDBLOCK) {
1493 1537                  curthread->t_flag &= ~T_WOULDBLOCK;
1494 1538                  resp->status = NFS3ERR_JUKEBOX;
1495 1539          } else
1496 1540                  resp->status = puterrno3(error);
1497 1541  err1:
1498 1542          vattr_to_wcc_data(bvap, avap, &resp->resfail.file_wcc);
1499 1543  out:
1500      -        DTRACE_NFSV3_4(op__write__done, struct svc_req *, req,
1501      -            cred_t *, cr, vnode_t *, vp, WRITE3res *, resp);
     1544 +        DTRACE_NFSV3_5(op__write__done, struct svc_req *, req,
     1545 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     1546 +            WRITE3res *, resp);
1502 1547  
1503 1548          if (vp != NULL) {
1504 1549                  if (rwlock_ret != -1)
1505 1550                          VOP_RWUNLOCK(vp, V_WRITELOCK_TRUE, &ct);
1506 1551                  if (in_crit)
1507 1552                          nbl_end_crit(vp);
1508 1553                  VN_RELE(vp);
1509 1554          }
1510 1555  }
1511 1556  
↓ open down ↓ 24 lines elided ↑ open up ↑
1536 1581          len_t reqsize;
1537 1582          bool_t trunc;
1538 1583          struct sockaddr *ca;
1539 1584          char *name = NULL;
1540 1585  
1541 1586          dbvap = NULL;
1542 1587          davap = NULL;
1543 1588  
1544 1589          dvp = nfs3_fhtovp(&args->where.dir, exi);
1545 1590  
1546      -        DTRACE_NFSV3_4(op__create__start, struct svc_req *, req,
1547      -            cred_t *, cr, vnode_t *, dvp, CREATE3args *, args);
     1591 +        DTRACE_NFSV3_5(op__create__start, struct svc_req *, req,
     1592 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     1593 +            CREATE3args *, args);
1548 1594  
1549 1595          if (dvp == NULL) {
1550 1596                  error = ESTALE;
1551 1597                  goto out;
1552 1598          }
1553 1599  
1554 1600          dbva.va_mask = AT_ALL;
1555 1601          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
1556 1602          davap = dbvap;
1557 1603  
↓ open down ↓ 278 lines elided ↑ open up ↑
1836 1882          if (tvp != NULL) {
1837 1883                  if (in_crit)
1838 1884                          nbl_end_crit(tvp);
1839 1885                  VN_RELE(tvp);
1840 1886          }
1841 1887  
1842 1888          resp->status = NFS3_OK;
1843 1889          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
1844 1890          vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
1845 1891  
1846      -        DTRACE_NFSV3_4(op__create__done, struct svc_req *, req,
1847      -            cred_t *, cr, vnode_t *, dvp, CREATE3res *, resp);
     1892 +        DTRACE_NFSV3_5(op__create__done, struct svc_req *, req,
     1893 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     1894 +            CREATE3res *, resp);
1848 1895  
1849 1896          VN_RELE(dvp);
1850 1897          return;
1851 1898  
1852 1899  out:
1853 1900          if (curthread->t_flag & T_WOULDBLOCK) {
1854 1901                  curthread->t_flag &= ~T_WOULDBLOCK;
1855 1902                  resp->status = NFS3ERR_JUKEBOX;
1856 1903          } else
1857 1904                  resp->status = puterrno3(error);
1858 1905  out1:
1859      -        DTRACE_NFSV3_4(op__create__done, struct svc_req *, req,
1860      -            cred_t *, cr, vnode_t *, dvp, CREATE3res *, resp);
     1906 +        DTRACE_NFSV3_5(op__create__done, struct svc_req *, req,
     1907 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     1908 +            CREATE3res *, resp);
1861 1909  
1862 1910          if (name != NULL && name != args->where.name)
1863 1911                  kmem_free(name, MAXPATHLEN + 1);
1864 1912  
1865 1913          if (tvp != NULL) {
1866 1914                  if (in_crit)
1867 1915                          nbl_end_crit(tvp);
1868 1916                  VN_RELE(tvp);
1869 1917          }
1870 1918          if (dvp != NULL)
↓ open down ↓ 22 lines elided ↑ open up ↑
1893 1941          struct vattr *davap;
1894 1942          struct vattr dava;
1895 1943          struct sockaddr *ca;
1896 1944          char *name = NULL;
1897 1945  
1898 1946          dbvap = NULL;
1899 1947          davap = NULL;
1900 1948  
1901 1949          dvp = nfs3_fhtovp(&args->where.dir, exi);
1902 1950  
1903      -        DTRACE_NFSV3_4(op__mkdir__start, struct svc_req *, req,
1904      -            cred_t *, cr, vnode_t *, dvp, MKDIR3args *, args);
     1951 +        DTRACE_NFSV3_5(op__mkdir__start, struct svc_req *, req,
     1952 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     1953 +            MKDIR3args *, args);
1905 1954  
1906 1955          if (dvp == NULL) {
1907 1956                  error = ESTALE;
1908 1957                  goto out;
1909 1958          }
1910 1959  
1911 1960          dbva.va_mask = AT_ALL;
1912 1961          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
1913 1962          davap = dbvap;
1914 1963  
↓ open down ↓ 78 lines elided ↑ open up ↑
1993 2042           * Force modified data and metadata out to stable storage.
1994 2043           */
1995 2044          (void) VOP_FSYNC(vp, 0, cr, NULL);
1996 2045  
1997 2046          VN_RELE(vp);
1998 2047  
1999 2048          resp->status = NFS3_OK;
2000 2049          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
2001 2050          vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
2002 2051  
2003      -        DTRACE_NFSV3_4(op__mkdir__done, struct svc_req *, req,
2004      -            cred_t *, cr, vnode_t *, dvp, MKDIR3res *, resp);
     2052 +        DTRACE_NFSV3_5(op__mkdir__done, struct svc_req *, req,
     2053 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2054 +            MKDIR3res *, resp);
2005 2055          VN_RELE(dvp);
2006 2056  
2007 2057          return;
2008 2058  
2009 2059  out:
2010 2060          if (curthread->t_flag & T_WOULDBLOCK) {
2011 2061                  curthread->t_flag &= ~T_WOULDBLOCK;
2012 2062                  resp->status = NFS3ERR_JUKEBOX;
2013 2063          } else
2014 2064                  resp->status = puterrno3(error);
2015 2065  out1:
2016      -        DTRACE_NFSV3_4(op__mkdir__done, struct svc_req *, req,
2017      -            cred_t *, cr, vnode_t *, dvp, MKDIR3res *, resp);
     2066 +        DTRACE_NFSV3_5(op__mkdir__done, struct svc_req *, req,
     2067 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2068 +            MKDIR3res *, resp);
2018 2069          if (dvp != NULL)
2019 2070                  VN_RELE(dvp);
2020 2071          vattr_to_wcc_data(dbvap, davap, &resp->resfail.dir_wcc);
2021 2072  }
2022 2073  
2023 2074  void *
2024 2075  rfs3_mkdir_getfh(MKDIR3args *args)
2025 2076  {
2026 2077  
2027 2078          return (&args->where.dir);
↓ open down ↓ 14 lines elided ↑ open up ↑
2042 2093          struct vattr dava;
2043 2094          struct sockaddr *ca;
2044 2095          char *name = NULL;
2045 2096          char *symdata = NULL;
2046 2097  
2047 2098          dbvap = NULL;
2048 2099          davap = NULL;
2049 2100  
2050 2101          dvp = nfs3_fhtovp(&args->where.dir, exi);
2051 2102  
2052      -        DTRACE_NFSV3_4(op__symlink__start, struct svc_req *, req,
2053      -            cred_t *, cr, vnode_t *, dvp, SYMLINK3args *, args);
     2103 +        DTRACE_NFSV3_5(op__symlink__start, struct svc_req *, req,
     2104 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2105 +            SYMLINK3args *, args);
2054 2106  
2055 2107          if (dvp == NULL) {
2056 2108                  error = ESTALE;
2057 2109                  goto err;
2058 2110          }
2059 2111  
2060 2112          dbva.va_mask = AT_ALL;
2061 2113          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2062 2114          davap = dbvap;
2063 2115  
↓ open down ↓ 116 lines elided ↑ open up ↑
2180 2232          } else
2181 2233                  resp->status = puterrno3(error);
2182 2234  err1:
2183 2235          vattr_to_wcc_data(dbvap, davap, &resp->resfail.dir_wcc);
2184 2236  out:
2185 2237          if (name != NULL && name != args->where.name)
2186 2238                  kmem_free(name, MAXPATHLEN + 1);
2187 2239          if (symdata != NULL && symdata != args->symlink.symlink_data)
2188 2240                  kmem_free(symdata, MAXPATHLEN + 1);
2189 2241  
2190      -        DTRACE_NFSV3_4(op__symlink__done, struct svc_req *, req,
2191      -            cred_t *, cr, vnode_t *, dvp, SYMLINK3res *, resp);
     2242 +        DTRACE_NFSV3_5(op__symlink__done, struct svc_req *, req,
     2243 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2244 +            SYMLINK3res *, resp);
2192 2245  
2193 2246          if (dvp != NULL)
2194 2247                  VN_RELE(dvp);
2195 2248  }
2196 2249  
2197 2250  void *
2198 2251  rfs3_symlink_getfh(SYMLINK3args *args)
2199 2252  {
2200 2253  
2201 2254          return (&args->where.dir);
↓ open down ↓ 16 lines elided ↑ open up ↑
2218 2271          int mode;
2219 2272          enum vcexcl excl;
2220 2273          struct sockaddr *ca;
2221 2274          char *name = NULL;
2222 2275  
2223 2276          dbvap = NULL;
2224 2277          davap = NULL;
2225 2278  
2226 2279          dvp = nfs3_fhtovp(&args->where.dir, exi);
2227 2280  
2228      -        DTRACE_NFSV3_4(op__mknod__start, struct svc_req *, req,
2229      -            cred_t *, cr, vnode_t *, dvp, MKNOD3args *, args);
     2281 +        DTRACE_NFSV3_5(op__mknod__start, struct svc_req *, req,
     2282 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2283 +            MKNOD3args *, args);
2230 2284  
2231 2285          if (dvp == NULL) {
2232 2286                  error = ESTALE;
2233 2287                  goto out;
2234 2288          }
2235 2289  
2236 2290          dbva.va_mask = AT_ALL;
2237 2291          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2238 2292          davap = dbvap;
2239 2293  
↓ open down ↓ 125 lines elided ↑ open up ↑
2365 2419           */
2366 2420          if (VOP_REALVP(vp, &realvp, NULL) == 0)
2367 2421                  (void) VOP_FSYNC(realvp, FNODSYNC, cr, NULL);
2368 2422          else
2369 2423                  (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
2370 2424  
2371 2425          VN_RELE(vp);
2372 2426  
2373 2427          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
2374 2428          vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
2375      -        DTRACE_NFSV3_4(op__mknod__done, struct svc_req *, req,
2376      -            cred_t *, cr, vnode_t *, dvp, MKNOD3res *, resp);
     2429 +        DTRACE_NFSV3_5(op__mknod__done, struct svc_req *, req,
     2430 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2431 +            MKNOD3res *, resp);
2377 2432          VN_RELE(dvp);
2378 2433          return;
2379 2434  
2380 2435  out:
2381 2436          if (curthread->t_flag & T_WOULDBLOCK) {
2382 2437                  curthread->t_flag &= ~T_WOULDBLOCK;
2383 2438                  resp->status = NFS3ERR_JUKEBOX;
2384 2439          } else
2385 2440                  resp->status = puterrno3(error);
2386 2441  out1:
2387      -        DTRACE_NFSV3_4(op__mknod__done, struct svc_req *, req,
2388      -            cred_t *, cr, vnode_t *, dvp, MKNOD3res *, resp);
     2442 +        DTRACE_NFSV3_5(op__mknod__done, struct svc_req *, req,
     2443 +            cred_t *, cr, vnode_t *, dvp, struct exportinfo *, exi,
     2444 +            MKNOD3res *, resp);
2389 2445          if (dvp != NULL)
2390 2446                  VN_RELE(dvp);
2391 2447          vattr_to_wcc_data(dbvap, davap, &resp->resfail.dir_wcc);
2392 2448  }
2393 2449  
2394 2450  void *
2395 2451  rfs3_mknod_getfh(MKNOD3args *args)
2396 2452  {
2397 2453  
2398 2454          return (&args->where.dir);
↓ open down ↓ 11 lines elided ↑ open up ↑
2410 2466          struct vattr ava;
2411 2467          vnode_t *targvp = NULL;
2412 2468          struct sockaddr *ca;
2413 2469          char *name = NULL;
2414 2470  
2415 2471          bvap = NULL;
2416 2472          avap = NULL;
2417 2473  
2418 2474          vp = nfs3_fhtovp(&args->object.dir, exi);
2419 2475  
2420      -        DTRACE_NFSV3_4(op__remove__start, struct svc_req *, req,
2421      -            cred_t *, cr, vnode_t *, vp, REMOVE3args *, args);
     2476 +        DTRACE_NFSV3_5(op__remove__start, struct svc_req *, req,
     2477 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     2478 +            REMOVE3args *, args);
2422 2479  
2423 2480          if (vp == NULL) {
2424 2481                  error = ESTALE;
2425 2482                  goto err;
2426 2483          }
2427 2484  
2428 2485          bva.va_mask = AT_ALL;
2429 2486          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2430 2487          avap = bvap;
2431 2488  
↓ open down ↓ 87 lines elided ↑ open up ↑
2519 2576  
2520 2577  err:
2521 2578          if (curthread->t_flag & T_WOULDBLOCK) {
2522 2579                  curthread->t_flag &= ~T_WOULDBLOCK;
2523 2580                  resp->status = NFS3ERR_JUKEBOX;
2524 2581          } else
2525 2582                  resp->status = puterrno3(error);
2526 2583  err1:
2527 2584          vattr_to_wcc_data(bvap, avap, &resp->resfail.dir_wcc);
2528 2585  out:
2529      -        DTRACE_NFSV3_4(op__remove__done, struct svc_req *, req,
2530      -            cred_t *, cr, vnode_t *, vp, REMOVE3res *, resp);
     2586 +        DTRACE_NFSV3_5(op__remove__done, struct svc_req *, req,
     2587 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     2588 +            REMOVE3res *, resp);
2531 2589  
2532 2590          if (name != NULL && name != args->object.name)
2533 2591                  kmem_free(name, MAXPATHLEN + 1);
2534 2592  
2535 2593          if (vp != NULL)
2536 2594                  VN_RELE(vp);
2537 2595  }
2538 2596  
2539 2597  void *
2540 2598  rfs3_remove_getfh(REMOVE3args *args)
↓ open down ↓ 13 lines elided ↑ open up ↑
2554 2612          struct vattr *avap;
2555 2613          struct vattr ava;
2556 2614          struct sockaddr *ca;
2557 2615          char *name = NULL;
2558 2616  
2559 2617          bvap = NULL;
2560 2618          avap = NULL;
2561 2619  
2562 2620          vp = nfs3_fhtovp(&args->object.dir, exi);
2563 2621  
2564      -        DTRACE_NFSV3_4(op__rmdir__start, struct svc_req *, req,
2565      -            cred_t *, cr, vnode_t *, vp, RMDIR3args *, args);
     2622 +        DTRACE_NFSV3_5(op__rmdir__start, struct svc_req *, req,
     2623 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     2624 +            RMDIR3args *, args);
2566 2625  
2567 2626          if (vp == NULL) {
2568 2627                  error = ESTALE;
2569 2628                  goto err;
2570 2629          }
2571 2630  
2572 2631          bva.va_mask = AT_ALL;
2573 2632          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2574 2633          avap = bvap;
2575 2634  
↓ open down ↓ 35 lines elided ↑ open up ↑
2611 2670  
2612 2671          ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
2613 2672          name = nfscmd_convname(ca, exi, args->object.name,
2614 2673              NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
2615 2674  
2616 2675          if (name == NULL) {
2617 2676                  resp->status = NFS3ERR_INVAL;
2618 2677                  goto err1;
2619 2678          }
2620 2679  
2621      -        error = VOP_RMDIR(vp, name, rootdir, cr, NULL, 0);
     2680 +        ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
     2681 +        error = VOP_RMDIR(vp, name, ZONE_ROOTVP(), cr, NULL, 0);
2622 2682  
2623 2683          if (name != args->object.name)
2624 2684                  kmem_free(name, MAXPATHLEN + 1);
2625 2685  
2626 2686          ava.va_mask = AT_ALL;
2627 2687          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2628 2688  
2629 2689          /*
2630 2690           * Force modified data and metadata out to stable storage.
2631 2691           */
↓ open down ↓ 17 lines elided ↑ open up ↑
2649 2709  
2650 2710  err:
2651 2711          if (curthread->t_flag & T_WOULDBLOCK) {
2652 2712                  curthread->t_flag &= ~T_WOULDBLOCK;
2653 2713                  resp->status = NFS3ERR_JUKEBOX;
2654 2714          } else
2655 2715                  resp->status = puterrno3(error);
2656 2716  err1:
2657 2717          vattr_to_wcc_data(bvap, avap, &resp->resfail.dir_wcc);
2658 2718  out:
2659      -        DTRACE_NFSV3_4(op__rmdir__done, struct svc_req *, req,
2660      -            cred_t *, cr, vnode_t *, vp, RMDIR3res *, resp);
     2719 +        DTRACE_NFSV3_5(op__rmdir__done, struct svc_req *, req,
     2720 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     2721 +            RMDIR3res *, resp);
2661 2722          if (vp != NULL)
2662 2723                  VN_RELE(vp);
2663 2724  
2664 2725  }
2665 2726  
2666 2727  void *
2667 2728  rfs3_rmdir_getfh(RMDIR3args *args)
2668 2729  {
2669 2730  
2670 2731          return (&args->object.dir);
↓ open down ↓ 24 lines elided ↑ open up ↑
2695 2756          char *toname = NULL;
2696 2757  
2697 2758          fbvap = NULL;
2698 2759          favap = NULL;
2699 2760          tbvap = NULL;
2700 2761          tavap = NULL;
2701 2762          tvp = NULL;
2702 2763  
2703 2764          fvp = nfs3_fhtovp(&args->from.dir, exi);
2704 2765  
2705      -        DTRACE_NFSV3_4(op__rename__start, struct svc_req *, req,
2706      -            cred_t *, cr, vnode_t *, fvp, RENAME3args *, args);
     2766 +        DTRACE_NFSV3_5(op__rename__start, struct svc_req *, req,
     2767 +            cred_t *, cr, vnode_t *, fvp, struct exportinfo *, exi,
     2768 +            RENAME3args *, args);
2707 2769  
2708 2770          if (fvp == NULL) {
2709 2771                  error = ESTALE;
2710 2772                  goto err;
2711 2773          }
2712 2774  
2713 2775          if (is_system_labeled()) {
2714 2776                  clabel = req->rq_label;
2715 2777                  ASSERT(clabel != NULL);
2716 2778                  DTRACE_PROBE2(tx__rfs3__log__info__oprename__clabel, char *,
↓ open down ↓ 96 lines elided ↑ open up ↑
2813 2875           * If we rename a delegated file we should recall the
2814 2876           * delegation, since future opens should fail or would
2815 2877           * refer to a new file.
2816 2878           */
2817 2879          if (rfs4_check_delegated(FWRITE, srcvp, FALSE)) {
2818 2880                  resp->status = NFS3ERR_JUKEBOX;
2819 2881                  goto err1;
2820 2882          }
2821 2883  
2822 2884          /*
2823      -         * Check for renaming over a delegated file.  Check rfs4_deleg_policy
     2885 +         * Check for renaming over a delegated file.  Check nfs4_deleg_policy
2824 2886           * first to avoid VOP_LOOKUP if possible.
2825 2887           */
2826      -        if (rfs4_deleg_policy != SRV_NEVER_DELEGATE &&
     2888 +        if (nfs4_get_deleg_policy() != SRV_NEVER_DELEGATE &&
2827 2889              VOP_LOOKUP(tvp, toname, &targvp, NULL, 0, NULL, cr,
2828 2890              NULL, NULL, NULL) == 0) {
2829 2891  
2830 2892                  if (rfs4_check_delegated(FWRITE, targvp, TRUE)) {
2831 2893                          VN_RELE(targvp);
2832 2894                          resp->status = NFS3ERR_JUKEBOX;
2833 2895                          goto err1;
2834 2896                  }
2835 2897                  VN_RELE(targvp);
2836 2898          }
↓ open down ↓ 43 lines elided ↑ open up ↑
2880 2942  err1:
2881 2943          vattr_to_wcc_data(fbvap, favap, &resp->resfail.fromdir_wcc);
2882 2944          vattr_to_wcc_data(tbvap, tavap, &resp->resfail.todir_wcc);
2883 2945  
2884 2946  out:
2885 2947          if (name != NULL && name != args->from.name)
2886 2948                  kmem_free(name, MAXPATHLEN + 1);
2887 2949          if (toname != NULL && toname != args->to.name)
2888 2950                  kmem_free(toname, MAXPATHLEN + 1);
2889 2951  
2890      -        DTRACE_NFSV3_4(op__rename__done, struct svc_req *, req,
2891      -            cred_t *, cr, vnode_t *, fvp, RENAME3res *, resp);
     2952 +        DTRACE_NFSV3_5(op__rename__done, struct svc_req *, req,
     2953 +            cred_t *, cr, vnode_t *, fvp, struct exportinfo *, exi,
     2954 +            RENAME3res *, resp);
2892 2955          if (fvp != NULL)
2893 2956                  VN_RELE(fvp);
2894 2957          if (tvp != NULL)
2895 2958                  VN_RELE(tvp);
2896 2959  }
2897 2960  
2898 2961  void *
2899 2962  rfs3_rename_getfh(RENAME3args *args)
2900 2963  {
2901 2964  
↓ open down ↓ 19 lines elided ↑ open up ↑
2921 2984          struct sockaddr *ca;
2922 2985          char *name = NULL;
2923 2986  
2924 2987          vap = NULL;
2925 2988          bvap = NULL;
2926 2989          avap = NULL;
2927 2990          dvp = NULL;
2928 2991  
2929 2992          vp = nfs3_fhtovp(&args->file, exi);
2930 2993  
2931      -        DTRACE_NFSV3_4(op__link__start, struct svc_req *, req,
2932      -            cred_t *, cr, vnode_t *, vp, LINK3args *, args);
     2994 +        DTRACE_NFSV3_5(op__link__start, struct svc_req *, req,
     2995 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     2996 +            LINK3args *, args);
2933 2997  
2934 2998          if (vp == NULL) {
2935 2999                  error = ESTALE;
2936 3000                  goto out;
2937 3001          }
2938 3002  
2939 3003          va.va_mask = AT_ALL;
2940 3004          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2941 3005  
2942 3006          fh3 = &args->link.dir;
↓ open down ↓ 91 lines elided ↑ open up ↑
3034 3098  
3035 3099          if (error)
3036 3100                  goto out;
3037 3101  
3038 3102          VN_RELE(dvp);
3039 3103  
3040 3104          resp->status = NFS3_OK;
3041 3105          vattr_to_post_op_attr(vap, &resp->resok.file_attributes);
3042 3106          vattr_to_wcc_data(bvap, avap, &resp->resok.linkdir_wcc);
3043 3107  
3044      -        DTRACE_NFSV3_4(op__link__done, struct svc_req *, req,
3045      -            cred_t *, cr, vnode_t *, vp, LINK3res *, resp);
     3108 +        DTRACE_NFSV3_5(op__link__done, struct svc_req *, req,
     3109 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3110 +            LINK3res *, resp);
3046 3111  
3047 3112          VN_RELE(vp);
3048 3113  
3049 3114          return;
3050 3115  
3051 3116  out:
3052 3117          if (curthread->t_flag & T_WOULDBLOCK) {
3053 3118                  curthread->t_flag &= ~T_WOULDBLOCK;
3054 3119                  resp->status = NFS3ERR_JUKEBOX;
3055 3120          } else
3056 3121                  resp->status = puterrno3(error);
3057 3122  out1:
3058 3123          if (name != NULL && name != args->link.name)
3059 3124                  kmem_free(name, MAXPATHLEN + 1);
3060 3125  
3061      -        DTRACE_NFSV3_4(op__link__done, struct svc_req *, req,
3062      -            cred_t *, cr, vnode_t *, vp, LINK3res *, resp);
     3126 +        DTRACE_NFSV3_5(op__link__done, struct svc_req *, req,
     3127 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3128 +            LINK3res *, resp);
3063 3129  
3064 3130          if (vp != NULL)
3065 3131                  VN_RELE(vp);
3066 3132          if (dvp != NULL)
3067 3133                  VN_RELE(dvp);
3068 3134          vattr_to_post_op_attr(vap, &resp->resfail.file_attributes);
3069 3135          vattr_to_wcc_data(bvap, avap, &resp->resfail.linkdir_wcc);
3070 3136  }
3071 3137  
3072 3138  void *
↓ open down ↓ 47 lines elided ↑ open up ↑
3120 3186          int iseof;
3121 3187          int bufsize;
3122 3188          int namlen;
3123 3189          uint_t count;
3124 3190          struct sockaddr *ca;
3125 3191  
3126 3192          vap = NULL;
3127 3193  
3128 3194          vp = nfs3_fhtovp(&args->dir, exi);
3129 3195  
3130      -        DTRACE_NFSV3_4(op__readdir__start, struct svc_req *, req,
3131      -            cred_t *, cr, vnode_t *, vp, READDIR3args *, args);
     3196 +        DTRACE_NFSV3_5(op__readdir__start, struct svc_req *, req,
     3197 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3198 +            READDIR3args *, args);
3132 3199  
3133 3200          if (vp == NULL) {
3134 3201                  error = ESTALE;
3135 3202                  goto out;
3136 3203          }
3137 3204  
3138 3205          if (is_system_labeled()) {
3139 3206                  bslabel_t *clabel = req->rq_label;
3140 3207  
3141 3208                  ASSERT(clabel != NULL);
↓ open down ↓ 143 lines elided ↑ open up ↑
3285 3352  
3286 3353          resp->status = NFS3_OK;
3287 3354          vattr_to_post_op_attr(vap, &resp->resok.dir_attributes);
3288 3355          resp->resok.cookieverf = 0;
3289 3356          resp->resok.reply.entries = (entry3 *)data;
3290 3357          resp->resok.reply.eof = iseof;
3291 3358          resp->resok.size = count - uio.uio_resid;
3292 3359          resp->resok.count = args->count;
3293 3360          resp->resok.freecount = count;
3294 3361  
3295      -        DTRACE_NFSV3_4(op__readdir__done, struct svc_req *, req,
3296      -            cred_t *, cr, vnode_t *, vp, READDIR3res *, resp);
     3362 +        DTRACE_NFSV3_5(op__readdir__done, struct svc_req *, req,
     3363 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3364 +            READDIR3res *, resp);
3297 3365  
3298 3366          VN_RELE(vp);
3299 3367  
3300 3368          return;
3301 3369  
3302 3370  out:
3303 3371          if (curthread->t_flag & T_WOULDBLOCK) {
3304 3372                  curthread->t_flag &= ~T_WOULDBLOCK;
3305 3373                  resp->status = NFS3ERR_JUKEBOX;
3306 3374          } else
3307 3375                  resp->status = puterrno3(error);
3308 3376  out1:
3309      -        DTRACE_NFSV3_4(op__readdir__done, struct svc_req *, req,
3310      -            cred_t *, cr, vnode_t *, vp, READDIR3res *, resp);
     3377 +        vattr_to_post_op_attr(vap, &resp->resfail.dir_attributes);
3311 3378  
     3379 +        DTRACE_NFSV3_5(op__readdir__done, struct svc_req *, req,
     3380 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3381 +            READDIR3res *, resp);
     3382 +
3312 3383          if (vp != NULL) {
3313 3384                  VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, NULL);
3314 3385                  VN_RELE(vp);
3315 3386          }
3316 3387          vattr_to_post_op_attr(vap, &resp->resfail.dir_attributes);
3317 3388  }
3318 3389  
3319 3390  void *
3320 3391  rfs3_readdir_getfh(READDIR3args *args)
3321 3392  {
↓ open down ↓ 69 lines elided ↑ open up ↑
3391 3462          int i;
3392 3463          uint_t *namlen = NULL;
3393 3464          char *ndata = NULL;
3394 3465          struct sockaddr *ca;
3395 3466          size_t ret;
3396 3467  
3397 3468          vap = NULL;
3398 3469  
3399 3470          vp = nfs3_fhtovp(&args->dir, exi);
3400 3471  
3401      -        DTRACE_NFSV3_4(op__readdirplus__start, struct svc_req *, req,
3402      -            cred_t *, cr, vnode_t *, vp, READDIRPLUS3args *, args);
     3472 +        DTRACE_NFSV3_5(op__readdirplus__start, struct svc_req *, req,
     3473 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3474 +            READDIRPLUS3args *, args);
3403 3475  
3404 3476          if (vp == NULL) {
3405 3477                  error = ESTALE;
3406 3478                  goto out;
3407 3479          }
3408 3480  
3409 3481          if (is_system_labeled()) {
3410 3482                  bslabel_t *clabel = req->rq_label;
3411 3483  
3412 3484                  ASSERT(clabel != NULL);
↓ open down ↓ 261 lines elided ↑ open up ↑
3674 3746  
3675 3747          resp->status = NFS3_OK;
3676 3748          vattr_to_post_op_attr(vap, &resp->resok.dir_attributes);
3677 3749          resp->resok.cookieverf = 0;
3678 3750          resp->resok.reply.entries = (entryplus3 *)ndata;
3679 3751          resp->resok.reply.eof = iseof;
3680 3752          resp->resok.size = nents;
3681 3753          resp->resok.count = args->dircount - ret;
3682 3754          resp->resok.maxcount = args->maxcount;
3683 3755  
3684      -        DTRACE_NFSV3_4(op__readdirplus__done, struct svc_req *, req,
3685      -            cred_t *, cr, vnode_t *, vp, READDIRPLUS3res *, resp);
3686      -        if (ndata != data)
3687      -                kmem_free(data, args->dircount);
     3756 +        DTRACE_NFSV3_5(op__readdirplus__done, struct svc_req *, req,
     3757 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3758 +            READDIRPLUS3res *, resp);
3688 3759  
3689      -
3690 3760          VN_RELE(vp);
3691 3761  
3692 3762          return;
3693 3763  
3694 3764  out:
3695 3765          if (curthread->t_flag & T_WOULDBLOCK) {
3696 3766                  curthread->t_flag &= ~T_WOULDBLOCK;
3697 3767                  resp->status = NFS3ERR_JUKEBOX;
3698 3768          } else {
3699 3769                  resp->status = puterrno3(error);
3700 3770          }
3701 3771  out1:
3702      -        DTRACE_NFSV3_4(op__readdirplus__done, struct svc_req *, req,
3703      -            cred_t *, cr, vnode_t *, vp, READDIRPLUS3res *, resp);
     3772 +        vattr_to_post_op_attr(vap, &resp->resfail.dir_attributes);
3704 3773  
     3774 +        DTRACE_NFSV3_5(op__readdirplus__done, struct svc_req *, req,
     3775 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3776 +            READDIRPLUS3res *, resp);
     3777 +
3705 3778          if (vp != NULL) {
3706 3779                  VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, NULL);
3707 3780                  VN_RELE(vp);
3708 3781          }
3709 3782  
3710 3783          if (namlen != NULL)
3711 3784                  kmem_free(namlen, args->dircount);
3712 3785  
3713 3786          vattr_to_post_op_attr(vap, &resp->resfail.dir_attributes);
3714 3787  }
↓ open down ↓ 24 lines elided ↑ open up ↑
3739 3812          int error;
3740 3813          vnode_t *vp;
3741 3814          struct vattr *vap;
3742 3815          struct vattr va;
3743 3816          struct statvfs64 sb;
3744 3817  
3745 3818          vap = NULL;
3746 3819  
3747 3820          vp = nfs3_fhtovp(&args->fsroot, exi);
3748 3821  
3749      -        DTRACE_NFSV3_4(op__fsstat__start, struct svc_req *, req,
3750      -            cred_t *, cr, vnode_t *, vp, FSSTAT3args *, args);
     3822 +        DTRACE_NFSV3_5(op__fsstat__start, struct svc_req *, req,
     3823 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3824 +            FSSTAT3args *, args);
3751 3825  
3752 3826          if (vp == NULL) {
3753 3827                  error = ESTALE;
3754 3828                  goto out;
3755 3829          }
3756 3830  
3757 3831          if (is_system_labeled()) {
3758 3832                  bslabel_t *clabel = req->rq_label;
3759 3833  
3760 3834                  ASSERT(clabel != NULL);
↓ open down ↓ 29 lines elided ↑ open up ↑
3790 3864                  resp->resok.fbytes = (size3)sb.f_bfree;
3791 3865          if (sb.f_bavail != (fsblkcnt64_t)-1)
3792 3866                  resp->resok.abytes = (size3)sb.f_frsize * (size3)sb.f_bavail;
3793 3867          else
3794 3868                  resp->resok.abytes = (size3)sb.f_bavail;
3795 3869          resp->resok.tfiles = (size3)sb.f_files;
3796 3870          resp->resok.ffiles = (size3)sb.f_ffree;
3797 3871          resp->resok.afiles = (size3)sb.f_favail;
3798 3872          resp->resok.invarsec = 0;
3799 3873  
3800      -        DTRACE_NFSV3_4(op__fsstat__done, struct svc_req *, req,
3801      -            cred_t *, cr, vnode_t *, vp, FSSTAT3res *, resp);
     3874 +        DTRACE_NFSV3_5(op__fsstat__done, struct svc_req *, req,
     3875 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3876 +            FSSTAT3res *, resp);
3802 3877          VN_RELE(vp);
3803 3878  
3804 3879          return;
3805 3880  
3806 3881  out:
3807 3882          if (curthread->t_flag & T_WOULDBLOCK) {
3808 3883                  curthread->t_flag &= ~T_WOULDBLOCK;
3809 3884                  resp->status = NFS3ERR_JUKEBOX;
3810 3885          } else
3811 3886                  resp->status = puterrno3(error);
3812 3887  out1:
3813      -        DTRACE_NFSV3_4(op__fsstat__done, struct svc_req *, req,
3814      -            cred_t *, cr, vnode_t *, vp, FSSTAT3res *, resp);
     3888 +        DTRACE_NFSV3_5(op__fsstat__done, struct svc_req *, req,
     3889 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3890 +            FSSTAT3res *, resp);
3815 3891  
3816 3892          if (vp != NULL)
3817 3893                  VN_RELE(vp);
3818 3894          vattr_to_post_op_attr(vap, &resp->resfail.obj_attributes);
3819 3895  }
3820 3896  
3821 3897  void *
3822 3898  rfs3_fsstat_getfh(FSSTAT3args *args)
3823 3899  {
3824 3900  
↓ open down ↓ 7 lines elided ↑ open up ↑
3832 3908  {
3833 3909          vnode_t *vp;
3834 3910          struct vattr *vap;
3835 3911          struct vattr va;
3836 3912          uint32_t xfer_size;
3837 3913          ulong_t l = 0;
3838 3914          int error;
3839 3915  
3840 3916          vp = nfs3_fhtovp(&args->fsroot, exi);
3841 3917  
3842      -        DTRACE_NFSV3_4(op__fsinfo__start, struct svc_req *, req,
3843      -            cred_t *, cr, vnode_t *, vp, FSINFO3args *, args);
     3918 +        DTRACE_NFSV3_5(op__fsinfo__start, struct svc_req *, req,
     3919 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3920 +            FSINFO3args *, args);
3844 3921  
3845 3922          if (vp == NULL) {
3846 3923                  if (curthread->t_flag & T_WOULDBLOCK) {
3847 3924                          curthread->t_flag &= ~T_WOULDBLOCK;
3848 3925                          resp->status = NFS3ERR_JUKEBOX;
3849 3926                  } else
3850 3927                          resp->status = NFS3ERR_STALE;
3851 3928                  vattr_to_post_op_attr(NULL, &resp->resfail.obj_attributes);
3852 3929                  goto out;
3853 3930          }
↓ open down ↓ 53 lines elided ↑ open up ↑
3907 3984                          resp->resok.maxfilesize = INT64_MAX;
3908 3985                  else
3909 3986                          resp->resok.maxfilesize = (1LL << (l-1)) - 1;
3910 3987          }
3911 3988  
3912 3989          resp->resok.time_delta.seconds = 0;
3913 3990          resp->resok.time_delta.nseconds = 1000;
3914 3991          resp->resok.properties = FSF3_LINK | FSF3_SYMLINK |
3915 3992              FSF3_HOMOGENEOUS | FSF3_CANSETTIME;
3916 3993  
3917      -        DTRACE_NFSV3_4(op__fsinfo__done, struct svc_req *, req,
3918      -            cred_t *, cr, vnode_t *, vp, FSINFO3res *, resp);
     3994 +        DTRACE_NFSV3_5(op__fsinfo__done, struct svc_req *, req,
     3995 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     3996 +            FSINFO3res *, resp);
3919 3997  
3920 3998          VN_RELE(vp);
3921 3999  
3922 4000          return;
3923 4001  
3924 4002  out:
3925      -        DTRACE_NFSV3_4(op__fsinfo__done, struct svc_req *, req,
3926      -            cred_t *, cr, vnode_t *, NULL, FSINFO3res *, resp);
     4003 +        DTRACE_NFSV3_5(op__fsinfo__done, struct svc_req *, req,
     4004 +            cred_t *, cr, vnode_t *, NULL, struct exportinfo *, exi,
     4005 +            FSINFO3res *, resp);
3927 4006          if (vp != NULL)
3928 4007                  VN_RELE(vp);
3929 4008  }
3930 4009  
3931 4010  void *
3932 4011  rfs3_fsinfo_getfh(FSINFO3args *args)
3933 4012  {
3934 4013          return (&args->fsroot);
3935 4014  }
3936 4015  
↓ open down ↓ 5 lines elided ↑ open up ↑
3942 4021          int error;
3943 4022          vnode_t *vp;
3944 4023          struct vattr *vap;
3945 4024          struct vattr va;
3946 4025          ulong_t val;
3947 4026  
3948 4027          vap = NULL;
3949 4028  
3950 4029          vp = nfs3_fhtovp(&args->object, exi);
3951 4030  
3952      -        DTRACE_NFSV3_4(op__pathconf__start, struct svc_req *, req,
3953      -            cred_t *, cr, vnode_t *, vp, PATHCONF3args *, args);
     4031 +        DTRACE_NFSV3_5(op__pathconf__start, struct svc_req *, req,
     4032 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4033 +            PATHCONF3args *, args);
3954 4034  
3955 4035          if (vp == NULL) {
3956 4036                  error = ESTALE;
3957 4037                  goto out;
3958 4038          }
3959 4039  
3960 4040          if (is_system_labeled()) {
3961 4041                  bslabel_t *clabel = req->rq_label;
3962 4042  
3963 4043                  ASSERT(clabel != NULL);
↓ open down ↓ 35 lines elided ↑ open up ↑
3999 4079                  goto out;
4000 4080          if (val == 1)
4001 4081                  resp->resok.info.chown_restricted = TRUE;
4002 4082          else
4003 4083                  resp->resok.info.chown_restricted = FALSE;
4004 4084  
4005 4085          resp->status = NFS3_OK;
4006 4086          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
4007 4087          resp->resok.info.case_insensitive = FALSE;
4008 4088          resp->resok.info.case_preserving = TRUE;
4009      -        DTRACE_NFSV3_4(op__pathconf__done, struct svc_req *, req,
4010      -            cred_t *, cr, vnode_t *, vp, PATHCONF3res *, resp);
     4089 +        DTRACE_NFSV3_5(op__pathconf__done, struct svc_req *, req,
     4090 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4091 +            PATHCONF3res *, resp);
4011 4092          VN_RELE(vp);
4012 4093          return;
4013 4094  
4014 4095  out:
4015 4096          if (curthread->t_flag & T_WOULDBLOCK) {
4016 4097                  curthread->t_flag &= ~T_WOULDBLOCK;
4017 4098                  resp->status = NFS3ERR_JUKEBOX;
4018 4099          } else
4019 4100                  resp->status = puterrno3(error);
4020 4101  out1:
4021      -        DTRACE_NFSV3_4(op__pathconf__done, struct svc_req *, req,
4022      -            cred_t *, cr, vnode_t *, vp, PATHCONF3res *, resp);
     4102 +        DTRACE_NFSV3_5(op__pathconf__done, struct svc_req *, req,
     4103 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4104 +            PATHCONF3res *, resp);
4023 4105          if (vp != NULL)
4024 4106                  VN_RELE(vp);
4025 4107          vattr_to_post_op_attr(vap, &resp->resfail.obj_attributes);
4026 4108  }
4027 4109  
4028 4110  void *
4029 4111  rfs3_pathconf_getfh(PATHCONF3args *args)
4030 4112  {
4031 4113  
4032 4114          return (&args->object);
4033 4115  }
4034 4116  
4035 4117  void
4036 4118  rfs3_commit(COMMIT3args *args, COMMIT3res *resp, struct exportinfo *exi,
4037 4119      struct svc_req *req, cred_t *cr, bool_t ro)
4038 4120  {
     4121 +        nfs3_srv_t *ns;
4039 4122          int error;
4040 4123          vnode_t *vp;
4041 4124          struct vattr *bvap;
4042 4125          struct vattr bva;
4043 4126          struct vattr *avap;
4044 4127          struct vattr ava;
4045 4128  
4046 4129          bvap = NULL;
4047 4130          avap = NULL;
4048 4131  
4049 4132          vp = nfs3_fhtovp(&args->file, exi);
4050 4133  
4051      -        DTRACE_NFSV3_4(op__commit__start, struct svc_req *, req,
4052      -            cred_t *, cr, vnode_t *, vp, COMMIT3args *, args);
     4134 +        DTRACE_NFSV3_5(op__commit__start, struct svc_req *, req,
     4135 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4136 +            COMMIT3args *, args);
4053 4137  
4054 4138          if (vp == NULL) {
4055 4139                  error = ESTALE;
4056 4140                  goto out;
4057 4141          }
4058 4142  
     4143 +        ASSERT3U(curzone->zone_id, ==, exi->exi_zoneid); /* exi is non-NULL. */
     4144 +        ns = nfs3_get_srv();
4059 4145          bva.va_mask = AT_ALL;
4060 4146          error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4061 4147  
4062 4148          /*
4063 4149           * If we can't get the attributes, then we can't do the
4064 4150           * right access checking.  So, we'll fail the request.
4065 4151           */
4066 4152          if (error)
4067 4153                  goto out;
4068 4154  
↓ open down ↓ 32 lines elided ↑ open up ↑
4101 4187          error = VOP_FSYNC(vp, FSYNC, cr, NULL);
4102 4188  
4103 4189          ava.va_mask = AT_ALL;
4104 4190          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
4105 4191  
4106 4192          if (error)
4107 4193                  goto out;
4108 4194  
4109 4195          resp->status = NFS3_OK;
4110 4196          vattr_to_wcc_data(bvap, avap, &resp->resok.file_wcc);
4111      -        resp->resok.verf = write3verf;
     4197 +        resp->resok.verf = ns->write3verf;
4112 4198  
4113      -        DTRACE_NFSV3_4(op__commit__done, struct svc_req *, req,
4114      -            cred_t *, cr, vnode_t *, vp, COMMIT3res *, resp);
     4199 +        DTRACE_NFSV3_5(op__commit__done, struct svc_req *, req,
     4200 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4201 +            COMMIT3res *, resp);
4115 4202  
4116 4203          VN_RELE(vp);
4117 4204  
4118 4205          return;
4119 4206  
4120 4207  out:
4121 4208          if (curthread->t_flag & T_WOULDBLOCK) {
4122 4209                  curthread->t_flag &= ~T_WOULDBLOCK;
4123 4210                  resp->status = NFS3ERR_JUKEBOX;
4124 4211          } else
4125 4212                  resp->status = puterrno3(error);
4126 4213  out1:
4127      -        DTRACE_NFSV3_4(op__commit__done, struct svc_req *, req,
4128      -            cred_t *, cr, vnode_t *, vp, COMMIT3res *, resp);
     4214 +        DTRACE_NFSV3_5(op__commit__done, struct svc_req *, req,
     4215 +            cred_t *, cr, vnode_t *, vp, struct exportinfo *, exi,
     4216 +            COMMIT3res *, resp);
4129 4217  
4130 4218          if (vp != NULL)
4131 4219                  VN_RELE(vp);
4132 4220          vattr_to_wcc_data(bvap, avap, &resp->resfail.file_wcc);
4133 4221  }
4134 4222  
4135 4223  void *
4136 4224  rfs3_commit_getfh(COMMIT3args *args)
4137 4225  {
4138 4226  
↓ open down ↓ 57 lines elided ↑ open up ↑
4196 4284                  vap->va_mtime.tv_nsec = (uint32_t)sap->mtime.mtime.nseconds;
4197 4285                  vap->va_mask |= AT_MTIME;
4198 4286          } else if (sap->mtime.set_it == SET_TO_SERVER_TIME) {
4199 4287                  gethrestime(&vap->va_mtime);
4200 4288                  vap->va_mask |= AT_MTIME;
4201 4289          }
4202 4290  
4203 4291          return (0);
4204 4292  }
4205 4293  
4206      -static ftype3 vt_to_nf3[] = {
     4294 +static const ftype3 vt_to_nf3[] = {
4207 4295          0, NF3REG, NF3DIR, NF3BLK, NF3CHR, NF3LNK, NF3FIFO, 0, 0, NF3SOCK, 0
4208 4296  };
4209 4297  
4210 4298  static int
4211 4299  vattr_to_fattr3(struct vattr *vap, fattr3 *fap)
4212 4300  {
4213 4301  
4214 4302          ASSERT(vap->va_type >= VNON && vap->va_type <= VBAD);
4215 4303          /* Return error if time or size overflow */
4216 4304          if (! (NFS_VAP_TIME_OK(vap) && NFS3_SIZE_OK(vap->va_size))) {
↓ open down ↓ 61 lines elided ↑ open up ↑
4278 4366          /* don't return attrs if time overflow */
4279 4367          if ((vap != NULL) && !vattr_to_fattr3(vap, &poap->attr)) {
4280 4368                  poap->attributes = TRUE;
4281 4369          } else
4282 4370                  poap->attributes = FALSE;
4283 4371  }
4284 4372  
4285 4373  static void
4286 4374  vattr_to_wcc_data(struct vattr *bvap, struct vattr *avap, wcc_data *wccp)
4287 4375  {
4288      -
4289 4376          vattr_to_pre_op_attr(bvap, &wccp->before);
4290 4377          vattr_to_post_op_attr(avap, &wccp->after);
4291 4378  }
4292 4379  
     4380 +static int
     4381 +rdma_setup_read_data3(READ3args *args, READ3resok *rok)
     4382 +{
     4383 +        struct clist    *wcl;
     4384 +        int             wlist_len;
     4385 +        count3          count = rok->count;
     4386 +
     4387 +        wcl = args->wlist;
     4388 +        if (rdma_setup_read_chunks(wcl, count, &wlist_len) == FALSE)
     4389 +                return (FALSE);
     4390 +
     4391 +        wcl = args->wlist;
     4392 +        rok->wlist_len = wlist_len;
     4393 +        rok->wlist = wcl;
     4394 +        return (TRUE);
     4395 +}
     4396 +
4293 4397  void
4294      -rfs3_srvrinit(void)
     4398 +rfs3_srv_zone_init(nfs_globals_t *ng)
4295 4399  {
     4400 +        nfs3_srv_t *ns;
4296 4401          struct rfs3_verf_overlay {
4297 4402                  uint_t id; /* a "unique" identifier */
4298 4403                  int ts; /* a unique timestamp */
4299 4404          } *verfp;
4300 4405          timestruc_t now;
4301 4406  
     4407 +        ns = kmem_zalloc(sizeof (*ns), KM_SLEEP);
     4408 +
4302 4409          /*
4303 4410           * The following algorithm attempts to find a unique verifier
4304 4411           * to be used as the write verifier returned from the server
4305 4412           * to the client.  It is important that this verifier change
4306 4413           * whenever the server reboots.  Of secondary importance, it
4307 4414           * is important for the verifier to be unique between two
4308 4415           * different servers.
4309 4416           *
4310 4417           * Thus, an attempt is made to use the system hostid and the
4311 4418           * current time in seconds when the nfssrv kernel module is
↓ open down ↓ 3 lines elided ↑ open up ↑
4315 4422           * time is used.  This will ensure different verifiers each
4316 4423           * time the server reboots and minimize the chances that two
4317 4424           * different servers will have the same verifier.
4318 4425           */
4319 4426  
4320 4427  #ifndef lint
4321 4428          /*
4322 4429           * We ASSERT that this constant logic expression is
4323 4430           * always true because in the past, it wasn't.
4324 4431           */
4325      -        ASSERT(sizeof (*verfp) <= sizeof (write3verf));
     4432 +        ASSERT(sizeof (*verfp) <= sizeof (ns->write3verf));
4326 4433  #endif
4327 4434  
4328 4435          gethrestime(&now);
4329      -        verfp = (struct rfs3_verf_overlay *)&write3verf;
     4436 +        verfp = (struct rfs3_verf_overlay *)&ns->write3verf;
4330 4437          verfp->ts = (int)now.tv_sec;
4331 4438          verfp->id = zone_get_hostid(NULL);
4332 4439  
4333 4440          if (verfp->id == 0)
4334 4441                  verfp->id = (uint_t)now.tv_nsec;
4335 4442  
4336      -        nfs3_srv_caller_id = fs_new_caller_id();
4337      -
     4443 +        ng->nfs3_srv = ns;
4338 4444  }
4339 4445  
4340      -static int
4341      -rdma_setup_read_data3(READ3args *args, READ3resok *rok)
     4446 +void
     4447 +rfs3_srv_zone_fini(nfs_globals_t *ng)
4342 4448  {
4343      -        struct clist    *wcl;
4344      -        int             wlist_len;
4345      -        count3          count = rok->count;
     4449 +        nfs3_srv_t *ns = ng->nfs3_srv;
4346 4450  
4347      -        wcl = args->wlist;
4348      -        if (rdma_setup_read_chunks(wcl, count, &wlist_len) == FALSE) {
4349      -                return (FALSE);
4350      -        }
     4451 +        ng->nfs3_srv = NULL;
4351 4452  
4352      -        wcl = args->wlist;
4353      -        rok->wlist_len = wlist_len;
4354      -        rok->wlist = wcl;
4355      -        return (TRUE);
     4453 +        kmem_free(ns, sizeof (*ns));
4356 4454  }
4357 4455  
     4456 +void
     4457 +rfs3_srvrinit(void)
     4458 +{
     4459 +        nfs3_srv_caller_id = fs_new_caller_id();
     4460 +}
     4461 +
4358 4462  void
4359 4463  rfs3_srvrfini(void)
4360 4464  {
4361 4465          /* Nothing to do */
4362 4466  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX