Print this page
*** NO COMMENTS ***

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 ↓ 63 lines elided ↑ open up ↑
  64   64  
  65   65  #include <inet/ip.h>
  66   66  #include <inet/ip6.h>
  67   67  
  68   68  /*
  69   69   * These are the interface routines for the server side of the
  70   70   * Network File System.  See the NFS version 3 protocol specification
  71   71   * for a description of this interface.
  72   72   */
  73   73  
  74      -#ifdef DEBUG
  75      -int rfs3_do_pre_op_attr = 1;
  76      -int rfs3_do_post_op_attr = 1;
  77      -int rfs3_do_post_op_fh3 = 1;
  78      -#endif
  79      -
  80   74  static writeverf3 write3verf;
  81   75  
  82   76  static int      sattr3_to_vattr(sattr3 *, struct vattr *);
  83   77  static int      vattr_to_fattr3(struct vattr *, fattr3 *);
  84   78  static int      vattr_to_wcc_attr(struct vattr *, wcc_attr *);
  85   79  static void     vattr_to_pre_op_attr(struct vattr *, pre_op_attr *);
  86   80  static void     vattr_to_wcc_data(struct vattr *, struct vattr *, wcc_data *);
  87   81  static int      rdma_setup_read_data3(READ3args *, READ3resok *);
  88   82  
  89   83  extern int nfs_loaned_buffers;
↓ open down ↓ 130 lines elided ↑ open up ↑
 220  214          bva.va_mask = AT_ALL;
 221  215          error = rfs4_delegated_getattr(vp, &bva, 0, cr);
 222  216  
 223  217          /*
 224  218           * If we can't get the attributes, then we can't do the
 225  219           * right access checking.  So, we'll fail the request.
 226  220           */
 227  221          if (error)
 228  222                  goto out;
 229  223  
 230      -#ifdef DEBUG
 231      -        if (rfs3_do_pre_op_attr)
 232      -                bvap = &bva;
 233      -#else
 234  224          bvap = &bva;
 235      -#endif
 236  225  
 237  226          if (rdonly(exi, req) || vn_is_readonly(vp)) {
 238  227                  resp->status = NFS3ERR_ROFS;
 239  228                  goto out1;
 240  229          }
 241  230  
 242  231          if (args->guard.check &&
 243  232              (args->guard.obj_ctime.seconds != bva.va_ctime.tv_sec ||
 244  233              args->guard.obj_ctime.nseconds != bva.va_ctime.tv_nsec)) {
 245  234                  resp->status = NFS3ERR_NOT_SYNC;
↓ open down ↓ 69 lines elided ↑ open up ↑
 315  304  
 316  305          if (!error && ava.va_mask)
 317  306                  error = VOP_SETATTR(vp, &ava, flag, cr, &ct);
 318  307  
 319  308          /* check if a monitor detected a delegation conflict */
 320  309          if (error == EAGAIN && (ct.cc_flags & CC_WOULDBLOCK)) {
 321  310                  resp->status = NFS3ERR_JUKEBOX;
 322  311                  goto out1;
 323  312          }
 324  313  
 325      -#ifdef DEBUG
 326      -        if (rfs3_do_post_op_attr) {
 327      -                ava.va_mask = AT_ALL;
 328      -                avap = rfs4_delegated_getattr(vp, &ava, 0, cr) ? NULL : &ava;
 329      -        } else
 330      -                avap = NULL;
 331      -#else
 332  314          ava.va_mask = AT_ALL;
 333  315          avap = rfs4_delegated_getattr(vp, &ava, 0, cr) ? NULL : &ava;
 334      -#endif
 335  316  
 336  317          /*
 337  318           * Force modified metadata out to stable storage.
 338  319           */
 339  320          (void) VOP_FSYNC(vp, FNODSYNC, cr, &ct);
 340  321  
 341  322          if (error)
 342  323                  goto out;
 343  324  
 344  325          if (in_crit)
↓ open down ↓ 69 lines elided ↑ open up ↑
 414  395  
 415  396                  DTRACE_NFSV3_4(op__lookup__start, struct svc_req *, req,
 416  397                      cred_t *, cr, vnode_t *, dvp, LOOKUP3args *, args);
 417  398  
 418  399                  if (dvp == NULL) {
 419  400                          error = ESTALE;
 420  401                          goto out;
 421  402                  }
 422  403          }
 423  404  
 424      -#ifdef DEBUG
 425      -        if (rfs3_do_pre_op_attr) {
 426      -                dva.va_mask = AT_ALL;
 427      -                dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 428      -        }
 429      -#else
 430  405          dva.va_mask = AT_ALL;
 431  406          dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 432      -#endif
 433  407  
 434  408          if (args->what.name == nfs3nametoolong) {
 435  409                  resp->status = NFS3ERR_NAMETOOLONG;
 436  410                  goto out1;
 437  411          }
 438  412  
 439  413          if (args->what.name == NULL || *(args->what.name) == '\0') {
 440  414                  resp->status = NFS3ERR_ACCES;
 441  415                  goto out1;
 442  416          }
↓ open down ↓ 7 lines elided ↑ open up ↑
 450  424  
 451  425          ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
 452  426          name = nfscmd_convname(ca, exi, args->what.name,
 453  427              NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
 454  428  
 455  429          if (name == NULL) {
 456  430                  resp->status = NFS3ERR_ACCES;
 457  431                  goto out1;
 458  432          }
 459  433  
      434 +        exi_hold(exi);
      435 +
 460  436          /*
 461  437           * If the public filehandle is used then allow
 462  438           * a multi-component lookup
 463  439           */
 464  440          if (PUBLIC_FH3(&args->what.dir)) {
      441 +                struct exportinfo *new;
      442 +
 465  443                  publicfh_flag = TRUE;
      444 +
 466  445                  error = rfs_publicfh_mclookup(name, dvp, cr, &vp,
 467      -                    &exi, &sec);
 468      -                if (error && exi != NULL)
 469      -                        exi_rele(exi); /* See comment below Re: publicfh_flag */
      446 +                    &new, &sec);
      447 +
      448 +                if (error == 0) {
      449 +                        exi_rele(exi);
      450 +                        exi = new;
      451 +                }
      452 +
 470  453                  /*
 471  454                   * Since WebNFS may bypass MOUNT, we need to ensure this
 472  455                   * request didn't come from an unlabeled admin_low client.
 473  456                   */
 474  457                  if (is_system_labeled() && error == 0) {
 475  458                          int             addr_type;
 476  459                          void            *ipaddr;
 477  460                          tsol_tpc_t      *tp;
 478  461  
 479  462                          if (ca->sa_family == AF_INET) {
↓ open down ↓ 1 lines elided ↑ open up ↑
 481  464                                  ipaddr = &((struct sockaddr_in *)ca)->sin_addr;
 482  465                          } else if (ca->sa_family == AF_INET6) {
 483  466                                  addr_type = IPV6_VERSION;
 484  467                                  ipaddr = &((struct sockaddr_in6 *)
 485  468                                      ca)->sin6_addr;
 486  469                          }
 487  470                          tp = find_tpc(ipaddr, addr_type, B_FALSE);
 488  471                          if (tp == NULL || tp->tpc_tp.tp_doi !=
 489  472                              l_admin_low->tsl_doi || tp->tpc_tp.host_type !=
 490  473                              SUN_CIPSO) {
 491      -                                if (exi != NULL)
 492      -                                        exi_rele(exi);
 493  474                                  VN_RELE(vp);
 494  475                                  resp->status = NFS3ERR_ACCES;
 495  476                                  error = 1;
 496  477                          }
 497  478                          if (tp != NULL)
 498  479                                  TPC_RELE(tp);
 499  480                  }
 500  481          } else {
 501  482                  error = VOP_LOOKUP(dvp, name, &vp,
 502  483                      NULL, 0, NULL, cr, NULL, NULL, NULL);
 503  484          }
 504  485  
 505  486          if (name != args->what.name)
 506  487                  kmem_free(name, MAXPATHLEN + 1);
 507  488  
      489 +        if (error == 0 && vn_ismntpt(vp)) {
      490 +                error = rfs_cross_mnt(&vp, &exi);
      491 +                if (error)
      492 +                        VN_RELE(vp);
      493 +        }
      494 +
 508  495          if (is_system_labeled() && error == 0) {
 509  496                  bslabel_t *clabel = req->rq_label;
 510  497  
 511  498                  ASSERT(clabel != NULL);
 512  499                  DTRACE_PROBE2(tx__rfs3__log__info__oplookup__clabel, char *,
 513  500                      "got client label from request(1)", struct svc_req *, req);
 514  501  
 515  502                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
 516  503                          if (!do_rfs_label_check(clabel, dvp,
 517  504                              DOMINANCE_CHECK, exi)) {
 518      -                                if (publicfh_flag && exi != NULL)
 519      -                                        exi_rele(exi);
 520  505                                  VN_RELE(vp);
 521  506                                  resp->status = NFS3ERR_ACCES;
 522  507                                  error = 1;
 523  508                          }
 524  509                  }
 525  510          }
 526  511  
 527      -#ifdef DEBUG
 528      -        if (rfs3_do_post_op_attr) {
 529      -                dva.va_mask = AT_ALL;
 530      -                dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 531      -        } else
 532      -                dvap = NULL;
 533      -#else
 534  512          dva.va_mask = AT_ALL;
 535  513          dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 536      -#endif
 537  514  
 538  515          if (error)
 539  516                  goto out;
 540  517  
 541  518          if (sec.sec_flags & SEC_QUERY) {
 542  519                  error = makefh3_ol(&resp->resok.object, exi, sec.sec_index);
 543  520          } else {
 544  521                  error = makefh3(&resp->resok.object, vp, exi);
 545  522                  if (!error && publicfh_flag && !chk_clnt_sec(exi, req))
 546  523                          auth_weak = TRUE;
 547  524          }
 548  525  
 549  526          if (error) {
 550  527                  VN_RELE(vp);
 551  528                  goto out;
 552  529          }
 553  530  
 554      -        /*
 555      -         * If publicfh_flag is true then we have called rfs_publicfh_mclookup
 556      -         * and have obtained a new exportinfo in exi which needs to be
 557      -         * released. Note the the original exportinfo pointed to by exi
 558      -         * will be released by the caller, common_dispatch.
 559      -         */
 560      -        if (publicfh_flag)
 561      -                exi_rele(exi);
 562      -
 563      -#ifdef DEBUG
 564      -        if (rfs3_do_post_op_attr) {
 565      -                va.va_mask = AT_ALL;
 566      -                vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 567      -        } else
 568      -                vap = NULL;
 569      -#else
 570  531          va.va_mask = AT_ALL;
 571  532          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 572      -#endif
 573  533  
      534 +        exi_rele(exi);
 574  535          VN_RELE(vp);
 575  536  
 576  537          resp->status = NFS3_OK;
 577  538          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 578  539          vattr_to_post_op_attr(dvap, &resp->resok.dir_attributes);
 579  540  
 580  541          /*
 581  542           * If it's public fh, no 0x81, and client's flavor is
 582  543           * invalid, set WebNFS status to WNFSERR_CLNT_FLAVOR now.
 583  544           * Then set RPC status to AUTH_TOOWEAK in common_dispatch.
↓ open down ↓ 1 lines elided ↑ open up ↑
 585  546          if (auth_weak)
 586  547                  resp->status = (enum nfsstat3)WNFSERR_CLNT_FLAVOR;
 587  548  
 588  549          DTRACE_NFSV3_4(op__lookup__done, struct svc_req *, req,
 589  550              cred_t *, cr, vnode_t *, dvp, LOOKUP3res *, resp);
 590  551          VN_RELE(dvp);
 591  552  
 592  553          return;
 593  554  
 594  555  out:
      556 +        /*
      557 +         * The passed argument exportinfo is released by the
      558 +         * caller, common_dispatch
      559 +         */
      560 +        exi_rele(exi);
      561 +
 595  562          if (curthread->t_flag & T_WOULDBLOCK) {
 596  563                  curthread->t_flag &= ~T_WOULDBLOCK;
 597  564                  resp->status = NFS3ERR_JUKEBOX;
 598  565          } else
 599  566                  resp->status = puterrno3(error);
 600  567  out1:
 601  568          DTRACE_NFSV3_4(op__lookup__done, struct svc_req *, req,
 602  569              cred_t *, cr, vnode_t *, dvp, LOOKUP3res *, resp);
 603  570  
 604  571          if (dvp != NULL)
↓ open down ↓ 50 lines elided ↑ open up ↑
 655  622           * We need the mode so that we can correctly determine access
 656  623           * permissions relative to a mandatory lock file.  Access to
 657  624           * mandatory lock files is denied on the server, so it might
 658  625           * as well be reflected to the server during the open.
 659  626           */
 660  627          va.va_mask = AT_MODE;
 661  628          error = VOP_GETATTR(vp, &va, 0, cr, NULL);
 662  629          if (error)
 663  630                  goto out;
 664  631  
 665      -#ifdef DEBUG
 666      -        if (rfs3_do_post_op_attr)
 667      -                vap = &va;
 668      -#else
 669  632          vap = &va;
 670      -#endif
 671  633  
 672  634          resp->resok.access = 0;
 673  635  
 674  636          if (is_system_labeled()) {
 675  637                  bslabel_t *clabel = req->rq_label;
 676  638  
 677  639                  ASSERT(clabel != NULL);
 678  640                  DTRACE_PROBE2(tx__rfs3__log__info__opaccess__clabel, char *,
 679  641                      "got client label from request(1)", struct svc_req *, req);
 680  642  
↓ open down ↓ 54 lines elided ↑ open up ↑
 735  697                  error = VOP_ACCESS(vp, VEXEC, 0, cr, NULL);
 736  698                  if (error) {
 737  699                          if (curthread->t_flag & T_WOULDBLOCK)
 738  700                                  goto out;
 739  701                  } else if (!MANDLOCK(vp, va.va_mode) &&
 740  702                      (!is_system_labeled() || admin_low_client ||
 741  703                      dominant_label))
 742  704                          resp->resok.access |= ACCESS3_EXECUTE;
 743  705          }
 744  706  
 745      -#ifdef DEBUG
 746      -        if (rfs3_do_post_op_attr) {
 747      -                va.va_mask = AT_ALL;
 748      -                vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 749      -        } else
 750      -                vap = NULL;
 751      -#else
 752  707          va.va_mask = AT_ALL;
 753  708          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 754      -#endif
 755  709  
 756  710          resp->status = NFS3_OK;
 757  711          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 758  712  
 759  713          DTRACE_NFSV3_4(op__access__done, struct svc_req *, req,
 760  714              cred_t *, cr, vnode_t *, vp, ACCESS3res *, resp);
 761  715  
 762  716          VN_RELE(vp);
 763  717  
 764  718          return;
↓ open down ↓ 44 lines elided ↑ open up ↑
 809  763          if (vp == NULL) {
 810  764                  error = ESTALE;
 811  765                  goto out;
 812  766          }
 813  767  
 814  768          va.va_mask = AT_ALL;
 815  769          error = VOP_GETATTR(vp, &va, 0, cr, NULL);
 816  770          if (error)
 817  771                  goto out;
 818  772  
 819      -#ifdef DEBUG
 820      -        if (rfs3_do_post_op_attr)
 821      -                vap = &va;
 822      -#else
 823  773          vap = &va;
 824      -#endif
 825  774  
 826  775          /* We lied about the object type for a referral */
 827  776          if (vn_is_nfs_reparse(vp, cr))
 828  777                  is_referral = 1;
 829  778  
 830  779          if (vp->v_type != VLNK && !is_referral) {
 831  780                  resp->status = NFS3ERR_INVAL;
 832  781                  goto out1;
 833  782          }
 834  783  
↓ open down ↓ 47 lines elided ↑ open up ↑
 882  831                  uio.uio_extflg = UIO_COPY_CACHED;
 883  832                  uio.uio_loffset = 0;
 884  833                  uio.uio_resid = MAXPATHLEN;
 885  834  
 886  835                  error = VOP_READLINK(vp, &uio, cr, NULL);
 887  836  
 888  837                  if (!error)
 889  838                          *(data + MAXPATHLEN - uio.uio_resid) = '\0';
 890  839          }
 891  840  
 892      -#ifdef DEBUG
 893      -        if (rfs3_do_post_op_attr) {
 894      -                va.va_mask = AT_ALL;
 895      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
 896      -        } else
 897      -                vap = NULL;
 898      -#else
 899  841          va.va_mask = AT_ALL;
 900  842          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
 901      -#endif
      843 +
 902  844          /* Lie about object type again just to be consistent */
 903  845          if (is_referral && vap != NULL)
 904  846                  vap->va_type = VLNK;
 905  847  
 906  848  #if 0 /* notyet */
 907  849          /*
 908  850           * Don't do this.  It causes local disk writes when just
 909  851           * reading the file and the overhead is deemed larger
 910  852           * than the benefit.
 911  853           */
↓ open down ↓ 158 lines elided ↑ open up ↑
1070 1012          va.va_mask = AT_ALL;
1071 1013          error = VOP_GETATTR(vp, &va, 0, cr, &ct);
1072 1014  
1073 1015          /*
1074 1016           * If we can't get the attributes, then we can't do the
1075 1017           * right access checking.  So, we'll fail the request.
1076 1018           */
1077 1019          if (error)
1078 1020                  goto out;
1079 1021  
1080      -#ifdef DEBUG
1081      -        if (rfs3_do_post_op_attr)
1082      -                vap = &va;
1083      -#else
1084 1022          vap = &va;
1085      -#endif
1086 1023  
1087 1024          if (vp->v_type != VREG) {
1088 1025                  resp->status = NFS3ERR_INVAL;
1089 1026                  goto out1;
1090 1027          }
1091 1028  
1092 1029          if (crgetuid(cr) != va.va_uid) {
1093 1030                  error = VOP_ACCESS(vp, VREAD, 0, cr, &ct);
1094 1031                  if (error) {
1095 1032                          if (curthread->t_flag & T_WOULDBLOCK)
↓ open down ↓ 129 lines elided ↑ open up ↑
1225 1162  
1226 1163          /* make mblk using zc buffers */
1227 1164          if (loaned_buffers) {
1228 1165                  mp = uio_to_mblk(uiop);
1229 1166                  ASSERT(mp != NULL);
1230 1167          }
1231 1168  
1232 1169          va.va_mask = AT_ALL;
1233 1170          error = VOP_GETATTR(vp, &va, 0, cr, &ct);
1234 1171  
1235      -#ifdef DEBUG
1236      -        if (rfs3_do_post_op_attr) {
1237      -                if (error)
1238      -                        vap = NULL;
1239      -                else
1240      -                        vap = &va;
1241      -        } else
1242      -                vap = NULL;
1243      -#else
1244 1172          if (error)
1245 1173                  vap = NULL;
1246 1174          else
1247 1175                  vap = &va;
1248      -#endif
1249 1176  
1250 1177          VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, &ct);
1251 1178  
1252 1179          if (in_crit)
1253 1180                  nbl_end_crit(vp);
1254 1181  
1255 1182          resp->status = NFS3_OK;
1256 1183          vattr_to_post_op_attr(vap, &resp->resok.file_attributes);
1257 1184          resp->resok.count = args->count - uiop->uio_resid;
1258 1185          if (!error && offset + resp->resok.count == va.va_size)
↓ open down ↓ 153 lines elided ↑ open up ↑
1412 1339          error = VOP_GETATTR(vp, &bva, 0, cr, &ct);
1413 1340  
1414 1341          /*
1415 1342           * If we can't get the attributes, then we can't do the
1416 1343           * right access checking.  So, we'll fail the request.
1417 1344           */
1418 1345          if (error)
1419 1346                  goto err;
1420 1347  
1421 1348          bvap = &bva;
1422      -#ifdef DEBUG
1423      -        if (!rfs3_do_pre_op_attr)
1424      -                bvap = NULL;
1425      -#endif
1426 1349          avap = bvap;
1427 1350  
1428 1351          if (args->count != args->data.data_len) {
1429 1352                  resp->status = NFS3ERR_INVAL;
1430 1353                  goto err1;
1431 1354          }
1432 1355  
1433 1356          if (rdonly(exi, req)) {
1434 1357                  resp->status = NFS3ERR_ROFS;
1435 1358                  goto err1;
↓ open down ↓ 91 lines elided ↑ open up ↑
1527 1450  
1528 1451          /* check if a monitor detected a delegation conflict */
1529 1452          if (error == EAGAIN && (ct.cc_flags & CC_WOULDBLOCK)) {
1530 1453                  resp->status = NFS3ERR_JUKEBOX;
1531 1454                  goto err1;
1532 1455          }
1533 1456  
1534 1457          ava.va_mask = AT_ALL;
1535 1458          avap = VOP_GETATTR(vp, &ava, 0, cr, &ct) ? NULL : &ava;
1536 1459  
1537      -#ifdef DEBUG
1538      -        if (!rfs3_do_post_op_attr)
1539      -                avap = NULL;
1540      -#endif
1541      -
1542 1460          if (error)
1543 1461                  goto err;
1544 1462  
1545 1463          /*
1546 1464           * If we were unable to get the V_WRITELOCK_TRUE, then we
1547 1465           * may not have accurate after attrs, so check if
1548 1466           * we have both attributes, they have a non-zero va_seq, and
1549 1467           * va_seq has changed by exactly one,
1550 1468           * if not, turn off the before attr.
1551 1469           */
↓ open down ↓ 68 lines elided ↑ open up ↑
1620 1538          dvp = nfs3_fhtovp(&args->where.dir, exi);
1621 1539  
1622 1540          DTRACE_NFSV3_4(op__create__start, struct svc_req *, req,
1623 1541              cred_t *, cr, vnode_t *, dvp, CREATE3args *, args);
1624 1542  
1625 1543          if (dvp == NULL) {
1626 1544                  error = ESTALE;
1627 1545                  goto out;
1628 1546          }
1629 1547  
1630      -#ifdef DEBUG
1631      -        if (rfs3_do_pre_op_attr) {
1632      -                dbva.va_mask = AT_ALL;
1633      -                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
1634      -        } else
1635      -                dbvap = NULL;
1636      -#else
1637 1548          dbva.va_mask = AT_ALL;
1638 1549          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
1639      -#endif
1640 1550          davap = dbvap;
1641 1551  
1642 1552          if (args->where.name == nfs3nametoolong) {
1643 1553                  resp->status = NFS3ERR_NAMETOOLONG;
1644 1554                  goto out1;
1645 1555          }
1646 1556  
1647 1557          if (args->where.name == NULL || *(args->where.name) == '\0') {
1648 1558                  resp->status = NFS3ERR_ACCES;
1649 1559                  goto out1;
↓ open down ↓ 142 lines elided ↑ open up ↑
1792 1702  tryagain:
1793 1703          /*
1794 1704           * The file open mode used is VWRITE.  If the client needs
1795 1705           * some other semantic, then it should do the access checking
1796 1706           * itself.  It would have been nice to have the file open mode
1797 1707           * passed as part of the arguments.
1798 1708           */
1799 1709          error = VOP_CREATE(dvp, name, &va, excl, VWRITE,
1800 1710              &vp, cr, 0, NULL, NULL);
1801 1711  
1802      -#ifdef DEBUG
1803      -        if (rfs3_do_post_op_attr) {
1804      -                dava.va_mask = AT_ALL;
1805      -                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
1806      -        } else
1807      -                davap = NULL;
1808      -#else
1809 1712          dava.va_mask = AT_ALL;
1810 1713          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
1811      -#endif
1812 1714  
1813 1715          if (error) {
1814 1716                  /*
1815 1717                   * If we got something other than file already exists
1816 1718                   * then just return this error.  Otherwise, we got
1817 1719                   * EEXIST.  If we were doing a GUARDED create, then
1818 1720                   * just return this error.  Otherwise, we need to
1819 1721                   * make sure that this wasn't a duplicate of an
1820 1722                   * exclusive create request.
1821 1723                   *
↓ open down ↓ 83 lines elided ↑ open up ↑
1905 1807                          va.va_size = reqsize;
1906 1808                          (void) VOP_SETATTR(vp, &va, 0, cr, NULL);
1907 1809                          va.va_mask = AT_ALL;
1908 1810                          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
1909 1811                  }
1910 1812          }
1911 1813  
1912 1814          if (name != args->where.name)
1913 1815                  kmem_free(name, MAXPATHLEN + 1);
1914 1816  
1915      -#ifdef DEBUG
1916      -        if (!rfs3_do_post_op_attr)
1917      -                vap = NULL;
1918      -#endif
1919      -
1920      -#ifdef DEBUG
1921      -        if (!rfs3_do_post_op_fh3)
1922      -                resp->resok.obj.handle_follows = FALSE;
1923      -        else {
1924      -#endif
1925 1817          error = makefh3(&resp->resok.obj.handle, vp, exi);
1926 1818          if (error)
1927 1819                  resp->resok.obj.handle_follows = FALSE;
1928 1820          else
1929 1821                  resp->resok.obj.handle_follows = TRUE;
1930      -#ifdef DEBUG
1931      -        }
1932      -#endif
1933 1822  
1934 1823          /*
1935 1824           * Force modified data and metadata out to stable storage.
1936 1825           */
1937 1826          (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
1938 1827          (void) VOP_FSYNC(dvp, 0, cr, NULL);
1939 1828  
1940 1829          VN_RELE(vp);
1941 1830          if (tvp != NULL) {
1942 1831                  if (in_crit)
↓ open down ↓ 63 lines elided ↑ open up ↑
2006 1895          dvp = nfs3_fhtovp(&args->where.dir, exi);
2007 1896  
2008 1897          DTRACE_NFSV3_4(op__mkdir__start, struct svc_req *, req,
2009 1898              cred_t *, cr, vnode_t *, dvp, MKDIR3args *, args);
2010 1899  
2011 1900          if (dvp == NULL) {
2012 1901                  error = ESTALE;
2013 1902                  goto out;
2014 1903          }
2015 1904  
2016      -#ifdef DEBUG
2017      -        if (rfs3_do_pre_op_attr) {
2018      -                dbva.va_mask = AT_ALL;
2019      -                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2020      -        } else
2021      -                dbvap = NULL;
2022      -#else
2023 1905          dbva.va_mask = AT_ALL;
2024 1906          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2025      -#endif
2026 1907          davap = dbvap;
2027 1908  
2028 1909          if (args->where.name == nfs3nametoolong) {
2029 1910                  resp->status = NFS3ERR_NAMETOOLONG;
2030 1911                  goto out1;
2031 1912          }
2032 1913  
2033 1914          if (args->where.name == NULL || *(args->where.name) == '\0') {
2034 1915                  resp->status = NFS3ERR_ACCES;
2035 1916                  goto out1;
↓ open down ↓ 39 lines elided ↑ open up ↑
2075 1956          }
2076 1957  
2077 1958          va.va_mask |= AT_TYPE;
2078 1959          va.va_type = VDIR;
2079 1960  
2080 1961          error = VOP_MKDIR(dvp, name, &va, &vp, cr, NULL, 0, NULL);
2081 1962  
2082 1963          if (name != args->where.name)
2083 1964                  kmem_free(name, MAXPATHLEN + 1);
2084 1965  
2085      -#ifdef DEBUG
2086      -        if (rfs3_do_post_op_attr) {
2087      -                dava.va_mask = AT_ALL;
2088      -                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2089      -        } else
2090      -                davap = NULL;
2091      -#else
2092 1966          dava.va_mask = AT_ALL;
2093 1967          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2094      -#endif
2095 1968  
2096 1969          /*
2097 1970           * Force modified data and metadata out to stable storage.
2098 1971           */
2099 1972          (void) VOP_FSYNC(dvp, 0, cr, NULL);
2100 1973  
2101 1974          if (error)
2102 1975                  goto out;
2103 1976  
2104      -#ifdef DEBUG
2105      -        if (!rfs3_do_post_op_fh3)
2106      -                resp->resok.obj.handle_follows = FALSE;
2107      -        else {
2108      -#endif
2109 1977          error = makefh3(&resp->resok.obj.handle, vp, exi);
2110 1978          if (error)
2111 1979                  resp->resok.obj.handle_follows = FALSE;
2112 1980          else
2113 1981                  resp->resok.obj.handle_follows = TRUE;
2114      -#ifdef DEBUG
2115      -        }
2116      -#endif
2117 1982  
2118      -#ifdef DEBUG
2119      -        if (rfs3_do_post_op_attr) {
2120      -                va.va_mask = AT_ALL;
2121      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2122      -        } else
2123      -                vap = NULL;
2124      -#else
2125 1983          va.va_mask = AT_ALL;
2126 1984          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2127      -#endif
2128 1985  
2129 1986          /*
2130 1987           * Force modified data and metadata out to stable storage.
2131 1988           */
2132 1989          (void) VOP_FSYNC(vp, 0, cr, NULL);
2133 1990  
2134 1991          VN_RELE(vp);
2135 1992  
2136 1993          resp->status = NFS3_OK;
2137 1994          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
↓ open down ↓ 49 lines elided ↑ open up ↑
2187 2044          dvp = nfs3_fhtovp(&args->where.dir, exi);
2188 2045  
2189 2046          DTRACE_NFSV3_4(op__symlink__start, struct svc_req *, req,
2190 2047              cred_t *, cr, vnode_t *, dvp, SYMLINK3args *, args);
2191 2048  
2192 2049          if (dvp == NULL) {
2193 2050                  error = ESTALE;
2194 2051                  goto err;
2195 2052          }
2196 2053  
2197      -#ifdef DEBUG
2198      -        if (rfs3_do_pre_op_attr) {
2199      -                dbva.va_mask = AT_ALL;
2200      -                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2201      -        } else
2202      -                dbvap = NULL;
2203      -#else
2204 2054          dbva.va_mask = AT_ALL;
2205 2055          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2206      -#endif
2207 2056          davap = dbvap;
2208 2057  
2209 2058          if (args->where.name == nfs3nametoolong) {
2210 2059                  resp->status = NFS3ERR_NAMETOOLONG;
2211 2060                  goto err1;
2212 2061          }
2213 2062  
2214 2063          if (args->where.name == NULL || *(args->where.name) == '\0') {
2215 2064                  resp->status = NFS3ERR_ACCES;
2216 2065                  goto err1;
↓ open down ↓ 51 lines elided ↑ open up ↑
2268 2117                  resp->status = NFS3ERR_INVAL;
2269 2118                  goto err1;
2270 2119          }
2271 2120  
2272 2121  
2273 2122          va.va_mask |= AT_TYPE;
2274 2123          va.va_type = VLNK;
2275 2124  
2276 2125          error = VOP_SYMLINK(dvp, name, &va, symdata, cr, NULL, 0);
2277 2126  
2278      -#ifdef DEBUG
2279      -        if (rfs3_do_post_op_attr) {
2280      -                dava.va_mask = AT_ALL;
2281      -                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2282      -        } else
2283      -                davap = NULL;
2284      -#else
2285 2127          dava.va_mask = AT_ALL;
2286 2128          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2287      -#endif
2288 2129  
2289 2130          if (error)
2290 2131                  goto err;
2291 2132  
2292 2133          error = VOP_LOOKUP(dvp, name, &vp, NULL, 0, NULL, cr,
2293 2134              NULL, NULL, NULL);
2294 2135  
2295 2136          /*
2296 2137           * Force modified data and metadata out to stable storage.
2297 2138           */
↓ open down ↓ 1 lines elided ↑ open up ↑
2299 2140  
2300 2141  
2301 2142          resp->status = NFS3_OK;
2302 2143          if (error) {
2303 2144                  resp->resok.obj.handle_follows = FALSE;
2304 2145                  vattr_to_post_op_attr(NULL, &resp->resok.obj_attributes);
2305 2146                  vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
2306 2147                  goto out;
2307 2148          }
2308 2149  
2309      -#ifdef DEBUG
2310      -        if (!rfs3_do_post_op_fh3)
2311      -                resp->resok.obj.handle_follows = FALSE;
2312      -        else {
2313      -#endif
2314 2150          error = makefh3(&resp->resok.obj.handle, vp, exi);
2315 2151          if (error)
2316 2152                  resp->resok.obj.handle_follows = FALSE;
2317 2153          else
2318 2154                  resp->resok.obj.handle_follows = TRUE;
2319      -#ifdef DEBUG
2320      -        }
2321      -#endif
2322 2155  
2323      -#ifdef DEBUG
2324      -        if (rfs3_do_post_op_attr) {
2325      -                va.va_mask = AT_ALL;
2326      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2327      -        } else
2328      -                vap = NULL;
2329      -#else
2330 2156          va.va_mask = AT_ALL;
2331 2157          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2332      -#endif
2333 2158  
2334 2159          /*
2335 2160           * Force modified data and metadata out to stable storage.
2336 2161           */
2337 2162          (void) VOP_FSYNC(vp, 0, cr, NULL);
2338 2163  
2339 2164          VN_RELE(vp);
2340 2165  
2341 2166          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
2342 2167          vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
↓ open down ↓ 52 lines elided ↑ open up ↑
2395 2220          dvp = nfs3_fhtovp(&args->where.dir, exi);
2396 2221  
2397 2222          DTRACE_NFSV3_4(op__mknod__start, struct svc_req *, req,
2398 2223              cred_t *, cr, vnode_t *, dvp, MKNOD3args *, args);
2399 2224  
2400 2225          if (dvp == NULL) {
2401 2226                  error = ESTALE;
2402 2227                  goto out;
2403 2228          }
2404 2229  
2405      -#ifdef DEBUG
2406      -        if (rfs3_do_pre_op_attr) {
2407      -                dbva.va_mask = AT_ALL;
2408      -                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2409      -        } else
2410      -                dbvap = NULL;
2411      -#else
2412 2230          dbva.va_mask = AT_ALL;
2413 2231          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2414      -#endif
2415 2232          davap = dbvap;
2416 2233  
2417 2234          if (args->where.name == nfs3nametoolong) {
2418 2235                  resp->status = NFS3ERR_NAMETOOLONG;
2419 2236                  goto out1;
2420 2237          }
2421 2238  
2422 2239          if (args->where.name == NULL || *(args->where.name) == '\0') {
2423 2240                  resp->status = NFS3ERR_ACCES;
2424 2241                  goto out1;
↓ open down ↓ 81 lines elided ↑ open up ↑
2506 2323          excl = EXCL;
2507 2324  
2508 2325          mode = 0;
2509 2326  
2510 2327          error = VOP_CREATE(dvp, name, &va, excl, mode,
2511 2328              &vp, cr, 0, NULL, NULL);
2512 2329  
2513 2330          if (name != args->where.name)
2514 2331                  kmem_free(name, MAXPATHLEN + 1);
2515 2332  
2516      -#ifdef DEBUG
2517      -        if (rfs3_do_post_op_attr) {
2518      -                dava.va_mask = AT_ALL;
2519      -                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2520      -        } else
2521      -                davap = NULL;
2522      -#else
2523 2333          dava.va_mask = AT_ALL;
2524 2334          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2525      -#endif
2526 2335  
2527 2336          /*
2528 2337           * Force modified data and metadata out to stable storage.
2529 2338           */
2530 2339          (void) VOP_FSYNC(dvp, 0, cr, NULL);
2531 2340  
2532 2341          if (error)
2533 2342                  goto out;
2534 2343  
2535 2344          resp->status = NFS3_OK;
2536 2345  
2537      -#ifdef DEBUG
2538      -        if (!rfs3_do_post_op_fh3)
2539      -                resp->resok.obj.handle_follows = FALSE;
2540      -        else {
2541      -#endif
2542 2346          error = makefh3(&resp->resok.obj.handle, vp, exi);
2543 2347          if (error)
2544 2348                  resp->resok.obj.handle_follows = FALSE;
2545 2349          else
2546 2350                  resp->resok.obj.handle_follows = TRUE;
2547      -#ifdef DEBUG
2548      -        }
2549      -#endif
2550 2351  
2551      -#ifdef DEBUG
2552      -        if (rfs3_do_post_op_attr) {
2553      -                va.va_mask = AT_ALL;
2554      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2555      -        } else
2556      -                vap = NULL;
2557      -#else
2558 2352          va.va_mask = AT_ALL;
2559 2353          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2560      -#endif
2561 2354  
2562 2355          /*
2563 2356           * Force modified metadata out to stable storage.
2564 2357           *
2565 2358           * if a underlying vp exists, pass it to VOP_FSYNC
2566 2359           */
2567 2360          if (VOP_REALVP(vp, &realvp, NULL) == 0)
2568 2361                  (void) VOP_FSYNC(realvp, FNODSYNC, cr, NULL);
2569 2362          else
2570 2363                  (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
↓ open down ↓ 48 lines elided ↑ open up ↑
2619 2412          vp = nfs3_fhtovp(&args->object.dir, exi);
2620 2413  
2621 2414          DTRACE_NFSV3_4(op__remove__start, struct svc_req *, req,
2622 2415              cred_t *, cr, vnode_t *, vp, REMOVE3args *, args);
2623 2416  
2624 2417          if (vp == NULL) {
2625 2418                  error = ESTALE;
2626 2419                  goto err;
2627 2420          }
2628 2421  
2629      -#ifdef DEBUG
2630      -        if (rfs3_do_pre_op_attr) {
2631      -                bva.va_mask = AT_ALL;
2632      -                bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2633      -        } else
2634      -                bvap = NULL;
2635      -#else
2636 2422          bva.va_mask = AT_ALL;
2637 2423          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2638      -#endif
2639 2424          avap = bvap;
2640 2425  
2641 2426          if (vp->v_type != VDIR) {
2642 2427                  resp->status = NFS3ERR_NOTDIR;
2643 2428                  goto err1;
2644 2429          }
2645 2430  
2646 2431          if (args->object.name == nfs3nametoolong) {
2647 2432                  resp->status = NFS3ERR_NAMETOOLONG;
2648 2433                  goto err1;
↓ open down ↓ 55 lines elided ↑ open up ↑
2704 2489                  if (nbl_conflict(targvp, NBL_REMOVE, 0, 0, 0, NULL)) {
2705 2490                          error = EACCES;
2706 2491                  } else {
2707 2492                          error = VOP_REMOVE(vp, name, cr, NULL, 0);
2708 2493                  }
2709 2494                  nbl_end_crit(targvp);
2710 2495          }
2711 2496          VN_RELE(targvp);
2712 2497          targvp = NULL;
2713 2498  
2714      -#ifdef DEBUG
2715      -        if (rfs3_do_post_op_attr) {
2716      -                ava.va_mask = AT_ALL;
2717      -                avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2718      -        } else
2719      -                avap = NULL;
2720      -#else
2721 2499          ava.va_mask = AT_ALL;
2722 2500          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2723      -#endif
2724 2501  
2725 2502          /*
2726 2503           * Force modified data and metadata out to stable storage.
2727 2504           */
2728 2505          (void) VOP_FSYNC(vp, 0, cr, NULL);
2729 2506  
2730 2507          if (error)
2731 2508                  goto err;
2732 2509  
2733 2510          resp->status = NFS3_OK;
↓ open down ↓ 45 lines elided ↑ open up ↑
2779 2556          vp = nfs3_fhtovp(&args->object.dir, exi);
2780 2557  
2781 2558          DTRACE_NFSV3_4(op__rmdir__start, struct svc_req *, req,
2782 2559              cred_t *, cr, vnode_t *, vp, RMDIR3args *, args);
2783 2560  
2784 2561          if (vp == NULL) {
2785 2562                  error = ESTALE;
2786 2563                  goto err;
2787 2564          }
2788 2565  
2789      -#ifdef DEBUG
2790      -        if (rfs3_do_pre_op_attr) {
2791      -                bva.va_mask = AT_ALL;
2792      -                bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2793      -        } else
2794      -                bvap = NULL;
2795      -#else
2796 2566          bva.va_mask = AT_ALL;
2797 2567          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2798      -#endif
2799 2568          avap = bvap;
2800 2569  
2801 2570          if (vp->v_type != VDIR) {
2802 2571                  resp->status = NFS3ERR_NOTDIR;
2803 2572                  goto err1;
2804 2573          }
2805 2574  
2806 2575          if (args->object.name == nfs3nametoolong) {
2807 2576                  resp->status = NFS3ERR_NAMETOOLONG;
2808 2577                  goto err1;
↓ open down ↓ 32 lines elided ↑ open up ↑
2841 2610          if (name == NULL) {
2842 2611                  resp->status = NFS3ERR_INVAL;
2843 2612                  goto err1;
2844 2613          }
2845 2614  
2846 2615          error = VOP_RMDIR(vp, name, rootdir, cr, NULL, 0);
2847 2616  
2848 2617          if (name != args->object.name)
2849 2618                  kmem_free(name, MAXPATHLEN + 1);
2850 2619  
2851      -#ifdef DEBUG
2852      -        if (rfs3_do_post_op_attr) {
2853      -                ava.va_mask = AT_ALL;
2854      -                avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2855      -        } else
2856      -                avap = NULL;
2857      -#else
2858 2620          ava.va_mask = AT_ALL;
2859 2621          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2860      -#endif
2861 2622  
2862 2623          /*
2863 2624           * Force modified data and metadata out to stable storage.
2864 2625           */
2865 2626          (void) VOP_FSYNC(vp, 0, cr, NULL);
2866 2627  
2867 2628          if (error) {
2868 2629                  /*
2869 2630                   * System V defines rmdir to return EEXIST, not ENOTEMPTY,
2870 2631                   * if the directory is not empty.  A System V NFS server
↓ open down ↓ 80 lines elided ↑ open up ↑
2951 2712  
2952 2713                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
2953 2714                          if (!do_rfs_label_check(clabel, fvp, EQUALITY_CHECK,
2954 2715                              exi)) {
2955 2716                                  resp->status = NFS3ERR_ACCES;
2956 2717                                  goto err1;
2957 2718                          }
2958 2719                  }
2959 2720          }
2960 2721  
2961      -#ifdef DEBUG
2962      -        if (rfs3_do_pre_op_attr) {
2963      -                fbva.va_mask = AT_ALL;
2964      -                fbvap = VOP_GETATTR(fvp, &fbva, 0, cr, NULL) ? NULL : &fbva;
2965      -        } else
2966      -                fbvap = NULL;
2967      -#else
2968 2722          fbva.va_mask = AT_ALL;
2969 2723          fbvap = VOP_GETATTR(fvp, &fbva, 0, cr, NULL) ? NULL : &fbva;
2970      -#endif
2971 2724          favap = fbvap;
2972 2725  
2973 2726          fh3 = &args->to.dir;
2974 2727          to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
2975 2728          if (to_exi == NULL) {
2976 2729                  resp->status = NFS3ERR_ACCES;
2977 2730                  goto err1;
2978 2731          }
2979 2732          exi_rele(to_exi);
2980 2733  
↓ open down ↓ 1 lines elided ↑ open up ↑
2982 2735                  resp->status = NFS3ERR_XDEV;
2983 2736                  goto err1;
2984 2737          }
2985 2738  
2986 2739          tvp = nfs3_fhtovp(&args->to.dir, exi);
2987 2740          if (tvp == NULL) {
2988 2741                  error = ESTALE;
2989 2742                  goto err;
2990 2743          }
2991 2744  
2992      -#ifdef DEBUG
2993      -        if (rfs3_do_pre_op_attr) {
2994      -                tbva.va_mask = AT_ALL;
2995      -                tbvap = VOP_GETATTR(tvp, &tbva, 0, cr, NULL) ? NULL : &tbva;
2996      -        } else
2997      -                tbvap = NULL;
2998      -#else
2999 2745          tbva.va_mask = AT_ALL;
3000 2746          tbvap = VOP_GETATTR(tvp, &tbva, 0, cr, NULL) ? NULL : &tbva;
3001      -#endif
3002 2747          tavap = tbvap;
3003 2748  
3004 2749          if (fvp->v_type != VDIR || tvp->v_type != VDIR) {
3005 2750                  resp->status = NFS3ERR_NOTDIR;
3006 2751                  goto err1;
3007 2752          }
3008 2753  
3009 2754          if (args->from.name == nfs3nametoolong ||
3010 2755              args->to.name == nfs3nametoolong) {
3011 2756                  resp->status = NFS3ERR_NAMETOOLONG;
↓ open down ↓ 81 lines elided ↑ open up ↑
3093 2838                  else
3094 2839                          error = VOP_RENAME(fvp, name, tvp, toname, cr, NULL, 0);
3095 2840                  nbl_end_crit(srcvp);
3096 2841          }
3097 2842          if (error == 0)
3098 2843                  vn_renamepath(tvp, srcvp, args->to.name,
3099 2844                      strlen(args->to.name));
3100 2845          VN_RELE(srcvp);
3101 2846          srcvp = NULL;
3102 2847  
3103      -#ifdef DEBUG
3104      -        if (rfs3_do_post_op_attr) {
3105      -                fava.va_mask = AT_ALL;
3106      -                favap = VOP_GETATTR(fvp, &fava, 0, cr, NULL) ? NULL : &fava;
3107      -                tava.va_mask = AT_ALL;
3108      -                tavap = VOP_GETATTR(tvp, &tava, 0, cr, NULL) ? NULL : &tava;
3109      -        } else {
3110      -                favap = NULL;
3111      -                tavap = NULL;
3112      -        }
3113      -#else
3114 2848          fava.va_mask = AT_ALL;
3115 2849          favap = VOP_GETATTR(fvp, &fava, 0, cr, NULL) ? NULL : &fava;
3116 2850          tava.va_mask = AT_ALL;
3117 2851          tavap = VOP_GETATTR(tvp, &tava, 0, cr, NULL) ? NULL : &tava;
3118      -#endif
3119 2852  
3120 2853          /*
3121 2854           * Force modified data and metadata out to stable storage.
3122 2855           */
3123 2856          (void) VOP_FSYNC(fvp, 0, cr, NULL);
3124 2857          (void) VOP_FSYNC(tvp, 0, cr, NULL);
3125 2858  
3126 2859          if (error)
3127 2860                  goto err;
3128 2861  
↓ open down ↓ 61 lines elided ↑ open up ↑
3190 2923          vp = nfs3_fhtovp(&args->file, exi);
3191 2924  
3192 2925          DTRACE_NFSV3_4(op__link__start, struct svc_req *, req,
3193 2926              cred_t *, cr, vnode_t *, vp, LINK3args *, args);
3194 2927  
3195 2928          if (vp == NULL) {
3196 2929                  error = ESTALE;
3197 2930                  goto out;
3198 2931          }
3199 2932  
3200      -#ifdef DEBUG
3201      -        if (rfs3_do_pre_op_attr) {
3202      -                va.va_mask = AT_ALL;
3203      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3204      -        } else
3205      -                vap = NULL;
3206      -#else
3207 2933          va.va_mask = AT_ALL;
3208 2934          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3209      -#endif
3210 2935  
3211 2936          fh3 = &args->link.dir;
3212 2937          to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
3213 2938          if (to_exi == NULL) {
3214 2939                  resp->status = NFS3ERR_ACCES;
3215 2940                  goto out1;
3216 2941          }
3217 2942          exi_rele(to_exi);
3218 2943  
3219 2944          if (to_exi != exi) {
↓ open down ↓ 16 lines elided ↑ open up ↑
3236 2961                          }
3237 2962                  }
3238 2963          }
3239 2964  
3240 2965          dvp = nfs3_fhtovp(&args->link.dir, exi);
3241 2966          if (dvp == NULL) {
3242 2967                  error = ESTALE;
3243 2968                  goto out;
3244 2969          }
3245 2970  
3246      -#ifdef DEBUG
3247      -        if (rfs3_do_pre_op_attr) {
3248      -                bva.va_mask = AT_ALL;
3249      -                bvap = VOP_GETATTR(dvp, &bva, 0, cr, NULL) ? NULL : &bva;
3250      -        } else
3251      -                bvap = NULL;
3252      -#else
3253 2971          bva.va_mask = AT_ALL;
3254 2972          bvap = VOP_GETATTR(dvp, &bva, 0, cr, NULL) ? NULL : &bva;
3255      -#endif
3256 2973  
3257 2974          if (dvp->v_type != VDIR) {
3258 2975                  resp->status = NFS3ERR_NOTDIR;
3259 2976                  goto out1;
3260 2977          }
3261 2978  
3262 2979          if (args->link.name == nfs3nametoolong) {
3263 2980                  resp->status = NFS3ERR_NAMETOOLONG;
3264 2981                  goto out1;
3265 2982          }
↓ open down ↓ 25 lines elided ↑ open up ↑
3291 3008          name = nfscmd_convname(ca, exi, args->link.name,
3292 3009              NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
3293 3010  
3294 3011          if (name == NULL) {
3295 3012                  resp->status = NFS3ERR_SERVERFAULT;
3296 3013                  goto out1;
3297 3014          }
3298 3015  
3299 3016          error = VOP_LINK(dvp, vp, name, cr, NULL, 0);
3300 3017  
3301      -#ifdef DEBUG
3302      -        if (rfs3_do_post_op_attr) {
3303      -                va.va_mask = AT_ALL;
3304      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3305      -                ava.va_mask = AT_ALL;
3306      -                avap = VOP_GETATTR(dvp, &ava, 0, cr, NULL) ? NULL : &ava;
3307      -        } else {
3308      -                vap = NULL;
3309      -                avap = NULL;
3310      -        }
3311      -#else
3312 3018          va.va_mask = AT_ALL;
3313 3019          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3314 3020          ava.va_mask = AT_ALL;
3315 3021          avap = VOP_GETATTR(dvp, &ava, 0, cr, NULL) ? NULL : &ava;
3316      -#endif
3317 3022  
3318 3023          /*
3319 3024           * Force modified data and metadata out to stable storage.
3320 3025           */
3321 3026          (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
3322 3027          (void) VOP_FSYNC(dvp, 0, cr, NULL);
3323 3028  
3324 3029          if (error)
3325 3030                  goto out;
3326 3031  
↓ open down ↓ 108 lines elided ↑ open up ↑
3435 3140                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
3436 3141                              exi)) {
3437 3142                                  resp->status = NFS3ERR_ACCES;
3438 3143                                  goto out1;
3439 3144                          }
3440 3145                  }
3441 3146          }
3442 3147  
3443 3148          (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
3444 3149  
3445      -#ifdef DEBUG
3446      -        if (rfs3_do_pre_op_attr) {
3447      -                va.va_mask = AT_ALL;
3448      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3449      -        } else
3450      -                vap = NULL;
3451      -#else
3452 3150          va.va_mask = AT_ALL;
3453 3151          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3454      -#endif
3455 3152  
3456 3153          if (vp->v_type != VDIR) {
3457 3154                  resp->status = NFS3ERR_NOTDIR;
3458 3155                  goto out1;
3459 3156          }
3460 3157  
3461 3158          error = VOP_ACCESS(vp, VREAD, 0, cr, NULL);
3462 3159          if (error)
3463 3160                  goto out;
3464 3161  
↓ open down ↓ 19 lines elided ↑ open up ↑
3484 3181          iov.iov_len = count;
3485 3182          uio.uio_iov = &iov;
3486 3183          uio.uio_iovcnt = 1;
3487 3184          uio.uio_segflg = UIO_SYSSPACE;
3488 3185          uio.uio_extflg = UIO_COPY_CACHED;
3489 3186          uio.uio_loffset = (offset_t)args->cookie;
3490 3187          uio.uio_resid = count;
3491 3188  
3492 3189          error = VOP_READDIR(vp, &uio, cr, &iseof, NULL, 0);
3493 3190  
3494      -#ifdef DEBUG
3495      -        if (rfs3_do_post_op_attr) {
3496      -                va.va_mask = AT_ALL;
3497      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3498      -        } else
3499      -                vap = NULL;
3500      -#else
3501 3191          va.va_mask = AT_ALL;
3502 3192          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3503      -#endif
3504 3193  
3505 3194          if (error) {
3506 3195                  kmem_free(data, count);
3507 3196                  goto out;
3508 3197          }
3509 3198  
3510 3199          /*
3511 3200           * If the count was not large enough to be able to guarantee
3512 3201           * to be able to return at least one entry, then need to
3513 3202           * check to see if NFS3ERR_TOOSMALL should be returned.
↓ open down ↓ 209 lines elided ↑ open up ↑
3723 3412                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
3724 3413                              exi)) {
3725 3414                                  resp->status = NFS3ERR_ACCES;
3726 3415                                  goto out1;
3727 3416                          }
3728 3417                  }
3729 3418          }
3730 3419  
3731 3420          (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
3732 3421  
3733      -#ifdef DEBUG
3734      -        if (rfs3_do_pre_op_attr) {
3735      -                va.va_mask = AT_ALL;
3736      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3737      -        } else
3738      -                vap = NULL;
3739      -#else
3740 3422          va.va_mask = AT_ALL;
3741 3423          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3742      -#endif
3743 3424  
3744 3425          if (vp->v_type != VDIR) {
3745 3426                  error = ENOTDIR;
3746 3427                  goto out;
3747 3428          }
3748 3429  
3749 3430          error = VOP_ACCESS(vp, VREAD, 0, cr, NULL);
3750 3431          if (error)
3751 3432                  goto out;
3752 3433  
↓ open down ↓ 138 lines elided ↑ open up ↑
3891 3572           * exceeded dircount then go back and get some more.
3892 3573           */
3893 3574          if (!iseof &&
3894 3575              (args->maxcount - bufsize) >= NFS3_READDIRPLUS_ENTRY(MAXNAMELEN)) {
3895 3576                  space_left -= (prev_len - uio.uio_resid);
3896 3577                  if (space_left >= DIRENT64_RECLEN(MAXNAMELEN))
3897 3578                          goto getmoredents;
3898 3579  
3899 3580                  /* else, fall through */
3900 3581          }
3901      -
3902 3582  good:
3903      -
3904      -#ifdef DEBUG
3905      -        if (rfs3_do_post_op_attr) {
3906      -                va.va_mask = AT_ALL;
3907      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3908      -        } else
3909      -                vap = NULL;
3910      -#else
3911 3583          va.va_mask = AT_ALL;
3912 3584          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3913      -#endif
3914 3585  
3915 3586          VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, NULL);
3916 3587  
3917 3588          infop = kmem_alloc(nents * sizeof (struct entryplus3_info), KM_SLEEP);
3918 3589          resp->resok.infop = infop;
3919 3590  
3920 3591          dp = (struct dirent64 *)data;
3921 3592          for (i = 0; i < nents; i++) {
3922 3593  
3923 3594                  if (dp->d_ino == 0) {
↓ open down ↓ 7 lines elided ↑ open up ↑
3931 3602  
3932 3603                  error = VOP_LOOKUP(vp, dp->d_name, &nvp, NULL, 0, NULL, cr,
3933 3604                      NULL, NULL, NULL);
3934 3605                  if (error) {
3935 3606                          infop[i].attr.attributes = FALSE;
3936 3607                          infop[i].fh.handle_follows = FALSE;
3937 3608                          dp = nextdp(dp);
3938 3609                          continue;
3939 3610                  }
3940 3611  
3941      -#ifdef DEBUG
3942      -                if (rfs3_do_post_op_attr) {
3943      -                        nva.va_mask = AT_ALL;
3944      -                        nvap = rfs4_delegated_getattr(nvp, &nva, 0, cr) ?
3945      -                            NULL : &nva;
3946      -                } else
3947      -                        nvap = NULL;
3948      -#else
3949 3612                  nva.va_mask = AT_ALL;
3950 3613                  nvap = rfs4_delegated_getattr(nvp, &nva, 0, cr) ? NULL : &nva;
3951      -#endif
     3614 +
3952 3615                  /* Lie about the object type for a referral */
3953 3616                  if (vn_is_nfs_reparse(nvp, cr))
3954 3617                          nvap->va_type = VLNK;
3955 3618  
3956      -                vattr_to_post_op_attr(nvap, &infop[i].attr);
3957      -
3958      -#ifdef DEBUG
3959      -                if (!rfs3_do_post_op_fh3)
3960      -                        infop[i].fh.handle_follows = FALSE;
3961      -                else {
3962      -#endif
3963      -                error = makefh3(&infop[i].fh.handle, nvp, exi);
3964      -                if (!error)
3965      -                        infop[i].fh.handle_follows = TRUE;
3966      -                else
     3619 +                if (vn_ismntpt(nvp)) {
     3620 +                        infop[i].attr.attributes = FALSE;
3967 3621                          infop[i].fh.handle_follows = FALSE;
3968      -#ifdef DEBUG
     3622 +                } else {
     3623 +                        vattr_to_post_op_attr(nvap, &infop[i].attr);
     3624 +
     3625 +                        error = makefh3(&infop[i].fh.handle, nvp, exi);
     3626 +                        if (!error)
     3627 +                                infop[i].fh.handle_follows = TRUE;
     3628 +                        else
     3629 +                                infop[i].fh.handle_follows = FALSE;
3969 3630                  }
3970      -#endif
3971 3631  
3972 3632                  VN_RELE(nvp);
3973 3633                  dp = nextdp(dp);
3974 3634          }
3975 3635  
3976 3636          ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
3977 3637          ret = nfscmd_convdirplus(ca, exi, data, nents, args->dircount, &ndata);
3978 3638          if (ndata == NULL)
3979 3639                  ndata = data;
3980 3640  
↓ open down ↓ 118 lines elided ↑ open up ↑
4099 3759                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4100 3760                              exi)) {
4101 3761                                  resp->status = NFS3ERR_ACCES;
4102 3762                                  goto out1;
4103 3763                          }
4104 3764                  }
4105 3765          }
4106 3766  
4107 3767          error = VFS_STATVFS(vp->v_vfsp, &sb);
4108 3768  
4109      -#ifdef DEBUG
4110      -        if (rfs3_do_post_op_attr) {
4111      -                va.va_mask = AT_ALL;
4112      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4113      -        } else
4114      -                vap = NULL;
4115      -#else
4116 3769          va.va_mask = AT_ALL;
4117 3770          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4118      -#endif
4119 3771  
4120 3772          if (error)
4121 3773                  goto out;
4122 3774  
4123 3775          resp->status = NFS3_OK;
4124 3776          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
4125 3777          if (sb.f_blocks != (fsblkcnt64_t)-1)
4126 3778                  resp->resok.tbytes = (size3)sb.f_frsize * (size3)sb.f_blocks;
4127 3779          else
4128 3780                  resp->resok.tbytes = (size3)sb.f_blocks;
↓ open down ↓ 75 lines elided ↑ open up ↑
4204 3856                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4205 3857                              exi)) {
4206 3858                                  resp->status = NFS3ERR_STALE;
4207 3859                                  vattr_to_post_op_attr(NULL,
4208 3860                                      &resp->resfail.obj_attributes);
4209 3861                                  goto out;
4210 3862                          }
4211 3863                  }
4212 3864          }
4213 3865  
4214      -#ifdef DEBUG
4215      -        if (rfs3_do_post_op_attr) {
4216      -                va.va_mask = AT_ALL;
4217      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4218      -        } else
4219      -                vap = NULL;
4220      -#else
4221 3866          va.va_mask = AT_ALL;
4222 3867          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4223      -#endif
4224 3868  
4225 3869          resp->status = NFS3_OK;
4226 3870          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
4227 3871          xfer_size = rfs3_tsize(req);
4228 3872          resp->resok.rtmax = xfer_size;
4229 3873          resp->resok.rtpref = xfer_size;
4230 3874          resp->resok.rtmult = DEV_BSIZE;
4231 3875          resp->resok.wtmax = xfer_size;
4232 3876          resp->resok.wtpref = xfer_size;
4233 3877          resp->resok.wtmult = DEV_BSIZE;
↓ open down ↓ 82 lines elided ↑ open up ↑
4316 3960  
4317 3961                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
4318 3962                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4319 3963                              exi)) {
4320 3964                                  resp->status = NFS3ERR_ACCES;
4321 3965                                  goto out1;
4322 3966                          }
4323 3967                  }
4324 3968          }
4325 3969  
4326      -#ifdef DEBUG
4327      -        if (rfs3_do_post_op_attr) {
4328      -                va.va_mask = AT_ALL;
4329      -                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4330      -        } else
4331      -                vap = NULL;
4332      -#else
4333 3970          va.va_mask = AT_ALL;
4334 3971          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4335      -#endif
4336 3972  
4337 3973          error = VOP_PATHCONF(vp, _PC_LINK_MAX, &val, cr, NULL);
4338 3974          if (error)
4339 3975                  goto out;
4340 3976          resp->resok.info.link_max = (uint32)val;
4341 3977  
4342 3978          error = VOP_PATHCONF(vp, _PC_NAME_MAX, &val, cr, NULL);
4343 3979          if (error)
4344 3980                  goto out;
4345 3981          resp->resok.info.name_max = (uint32)val;
↓ open down ↓ 71 lines elided ↑ open up ↑
4417 4053          bva.va_mask = AT_ALL;
4418 4054          error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4419 4055  
4420 4056          /*
4421 4057           * If we can't get the attributes, then we can't do the
4422 4058           * right access checking.  So, we'll fail the request.
4423 4059           */
4424 4060          if (error)
4425 4061                  goto out;
4426 4062  
4427      -#ifdef DEBUG
4428      -        if (rfs3_do_pre_op_attr)
4429      -                bvap = &bva;
4430      -        else
4431      -                bvap = NULL;
4432      -#else
4433 4063          bvap = &bva;
4434      -#endif
4435 4064  
4436 4065          if (rdonly(exi, req)) {
4437 4066                  resp->status = NFS3ERR_ROFS;
4438 4067                  goto out1;
4439 4068          }
4440 4069  
4441 4070          if (vp->v_type != VREG) {
4442 4071                  resp->status = NFS3ERR_INVAL;
4443 4072                  goto out1;
4444 4073          }
↓ open down ↓ 13 lines elided ↑ open up ↑
4458 4087                          }
4459 4088                  }
4460 4089          }
4461 4090  
4462 4091          if (crgetuid(cr) != bva.va_uid &&
4463 4092              (error = VOP_ACCESS(vp, VWRITE, 0, cr, NULL)))
4464 4093                  goto out;
4465 4094  
4466 4095          error = VOP_FSYNC(vp, FSYNC, cr, NULL);
4467 4096  
4468      -#ifdef DEBUG
4469      -        if (rfs3_do_post_op_attr) {
4470      -                ava.va_mask = AT_ALL;
4471      -                avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
4472      -        } else
4473      -                avap = NULL;
4474      -#else
4475 4097          ava.va_mask = AT_ALL;
4476 4098          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
4477      -#endif
4478 4099  
4479 4100          if (error)
4480 4101                  goto out;
4481 4102  
4482 4103          resp->status = NFS3_OK;
4483 4104          vattr_to_wcc_data(bvap, avap, &resp->resok.file_wcc);
4484 4105          resp->resok.verf = write3verf;
4485 4106  
4486 4107          DTRACE_NFSV3_4(op__commit__done, struct svc_req *, req,
4487 4108              cred_t *, cr, vnode_t *, vp, COMMIT3res *, resp);
↓ open down ↓ 248 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX