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 ↓ 74 lines elided ↑ open up ↑
 517  491                              DOMINANCE_CHECK, exi)) {
 518  492                                  if (publicfh_flag && exi != NULL)
 519  493                                          exi_rele(exi);
 520  494                                  VN_RELE(vp);
 521  495                                  resp->status = NFS3ERR_ACCES;
 522  496                                  error = 1;
 523  497                          }
 524  498                  }
 525  499          }
 526  500  
 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  501          dva.va_mask = AT_ALL;
 535  502          dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
 536      -#endif
 537  503  
 538  504          if (error)
 539  505                  goto out;
 540  506  
 541  507          if (sec.sec_flags & SEC_QUERY) {
 542  508                  error = makefh3_ol(&resp->resok.object, exi, sec.sec_index);
 543  509          } else {
 544  510                  error = makefh3(&resp->resok.object, vp, exi);
 545  511                  if (!error && publicfh_flag && !chk_clnt_sec(exi, req))
 546  512                          auth_weak = TRUE;
↓ open down ↓ 6 lines elided ↑ open up ↑
 553  519  
 554  520          /*
 555  521           * If publicfh_flag is true then we have called rfs_publicfh_mclookup
 556  522           * and have obtained a new exportinfo in exi which needs to be
 557  523           * released. Note the the original exportinfo pointed to by exi
 558  524           * will be released by the caller, common_dispatch.
 559  525           */
 560  526          if (publicfh_flag)
 561  527                  exi_rele(exi);
 562  528  
 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  529          va.va_mask = AT_ALL;
 571  530          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 572      -#endif
 573  531  
 574  532          VN_RELE(vp);
 575  533  
 576  534          resp->status = NFS3_OK;
 577  535          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 578  536          vattr_to_post_op_attr(dvap, &resp->resok.dir_attributes);
 579  537  
 580  538          /*
 581  539           * If it's public fh, no 0x81, and client's flavor is
 582  540           * invalid, set WebNFS status to WNFSERR_CLNT_FLAVOR now.
↓ open down ↓ 72 lines elided ↑ open up ↑
 655  613           * We need the mode so that we can correctly determine access
 656  614           * permissions relative to a mandatory lock file.  Access to
 657  615           * mandatory lock files is denied on the server, so it might
 658  616           * as well be reflected to the server during the open.
 659  617           */
 660  618          va.va_mask = AT_MODE;
 661  619          error = VOP_GETATTR(vp, &va, 0, cr, NULL);
 662  620          if (error)
 663  621                  goto out;
 664  622  
 665      -#ifdef DEBUG
 666      -        if (rfs3_do_post_op_attr)
 667      -                vap = &va;
 668      -#else
 669  623          vap = &va;
 670      -#endif
 671  624  
 672  625          resp->resok.access = 0;
 673  626  
 674  627          if (is_system_labeled()) {
 675  628                  bslabel_t *clabel = req->rq_label;
 676  629  
 677  630                  ASSERT(clabel != NULL);
 678  631                  DTRACE_PROBE2(tx__rfs3__log__info__opaccess__clabel, char *,
 679  632                      "got client label from request(1)", struct svc_req *, req);
 680  633  
↓ open down ↓ 54 lines elided ↑ open up ↑
 735  688                  error = VOP_ACCESS(vp, VEXEC, 0, cr, NULL);
 736  689                  if (error) {
 737  690                          if (curthread->t_flag & T_WOULDBLOCK)
 738  691                                  goto out;
 739  692                  } else if (!MANDLOCK(vp, va.va_mode) &&
 740  693                      (!is_system_labeled() || admin_low_client ||
 741  694                      dominant_label))
 742  695                          resp->resok.access |= ACCESS3_EXECUTE;
 743  696          }
 744  697  
 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  698          va.va_mask = AT_ALL;
 753  699          vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
 754      -#endif
 755  700  
 756  701          resp->status = NFS3_OK;
 757  702          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 758  703  
 759  704          DTRACE_NFSV3_4(op__access__done, struct svc_req *, req,
 760  705              cred_t *, cr, vnode_t *, vp, ACCESS3res *, resp);
 761  706  
 762  707          VN_RELE(vp);
 763  708  
 764  709          return;
↓ open down ↓ 44 lines elided ↑ open up ↑
 809  754          if (vp == NULL) {
 810  755                  error = ESTALE;
 811  756                  goto out;
 812  757          }
 813  758  
 814  759          va.va_mask = AT_ALL;
 815  760          error = VOP_GETATTR(vp, &va, 0, cr, NULL);
 816  761          if (error)
 817  762                  goto out;
 818  763  
 819      -#ifdef DEBUG
 820      -        if (rfs3_do_post_op_attr)
 821      -                vap = &va;
 822      -#else
 823  764          vap = &va;
 824      -#endif
 825  765  
 826  766          /* We lied about the object type for a referral */
 827  767          if (vn_is_nfs_reparse(vp, cr))
 828  768                  is_referral = 1;
 829  769  
 830  770          if (vp->v_type != VLNK && !is_referral) {
 831  771                  resp->status = NFS3ERR_INVAL;
 832  772                  goto out1;
 833  773          }
 834  774  
↓ open down ↓ 47 lines elided ↑ open up ↑
 882  822                  uio.uio_extflg = UIO_COPY_CACHED;
 883  823                  uio.uio_loffset = 0;
 884  824                  uio.uio_resid = MAXPATHLEN;
 885  825  
 886  826                  error = VOP_READLINK(vp, &uio, cr, NULL);
 887  827  
 888  828                  if (!error)
 889  829                          *(data + MAXPATHLEN - uio.uio_resid) = '\0';
 890  830          }
 891  831  
 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  832          va.va_mask = AT_ALL;
 900  833          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
 901      -#endif
      834 +
 902  835          /* Lie about object type again just to be consistent */
 903  836          if (is_referral && vap != NULL)
 904  837                  vap->va_type = VLNK;
 905  838  
 906  839  #if 0 /* notyet */
 907  840          /*
 908  841           * Don't do this.  It causes local disk writes when just
 909  842           * reading the file and the overhead is deemed larger
 910  843           * than the benefit.
 911  844           */
↓ open down ↓ 158 lines elided ↑ open up ↑
1070 1003          va.va_mask = AT_ALL;
1071 1004          error = VOP_GETATTR(vp, &va, 0, cr, &ct);
1072 1005  
1073 1006          /*
1074 1007           * If we can't get the attributes, then we can't do the
1075 1008           * right access checking.  So, we'll fail the request.
1076 1009           */
1077 1010          if (error)
1078 1011                  goto out;
1079 1012  
1080      -#ifdef DEBUG
1081      -        if (rfs3_do_post_op_attr)
1082      -                vap = &va;
1083      -#else
1084 1013          vap = &va;
1085      -#endif
1086 1014  
1087 1015          if (vp->v_type != VREG) {
1088 1016                  resp->status = NFS3ERR_INVAL;
1089 1017                  goto out1;
1090 1018          }
1091 1019  
1092 1020          if (crgetuid(cr) != va.va_uid) {
1093 1021                  error = VOP_ACCESS(vp, VREAD, 0, cr, &ct);
1094 1022                  if (error) {
1095 1023                          if (curthread->t_flag & T_WOULDBLOCK)
↓ open down ↓ 129 lines elided ↑ open up ↑
1225 1153  
1226 1154          /* make mblk using zc buffers */
1227 1155          if (loaned_buffers) {
1228 1156                  mp = uio_to_mblk(uiop);
1229 1157                  ASSERT(mp != NULL);
1230 1158          }
1231 1159  
1232 1160          va.va_mask = AT_ALL;
1233 1161          error = VOP_GETATTR(vp, &va, 0, cr, &ct);
1234 1162  
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 1163          if (error)
1245 1164                  vap = NULL;
1246 1165          else
1247 1166                  vap = &va;
1248      -#endif
1249 1167  
1250 1168          VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, &ct);
1251 1169  
1252 1170          if (in_crit)
1253 1171                  nbl_end_crit(vp);
1254 1172  
1255 1173          resp->status = NFS3_OK;
1256 1174          vattr_to_post_op_attr(vap, &resp->resok.file_attributes);
1257 1175          resp->resok.count = args->count - uiop->uio_resid;
1258 1176          if (!error && offset + resp->resok.count == va.va_size)
↓ open down ↓ 153 lines elided ↑ open up ↑
1412 1330          error = VOP_GETATTR(vp, &bva, 0, cr, &ct);
1413 1331  
1414 1332          /*
1415 1333           * If we can't get the attributes, then we can't do the
1416 1334           * right access checking.  So, we'll fail the request.
1417 1335           */
1418 1336          if (error)
1419 1337                  goto err;
1420 1338  
1421 1339          bvap = &bva;
1422      -#ifdef DEBUG
1423      -        if (!rfs3_do_pre_op_attr)
1424      -                bvap = NULL;
1425      -#endif
1426 1340          avap = bvap;
1427 1341  
1428 1342          if (args->count != args->data.data_len) {
1429 1343                  resp->status = NFS3ERR_INVAL;
1430 1344                  goto err1;
1431 1345          }
1432 1346  
1433 1347          if (rdonly(exi, req)) {
1434 1348                  resp->status = NFS3ERR_ROFS;
1435 1349                  goto err1;
↓ open down ↓ 91 lines elided ↑ open up ↑
1527 1441  
1528 1442          /* check if a monitor detected a delegation conflict */
1529 1443          if (error == EAGAIN && (ct.cc_flags & CC_WOULDBLOCK)) {
1530 1444                  resp->status = NFS3ERR_JUKEBOX;
1531 1445                  goto err1;
1532 1446          }
1533 1447  
1534 1448          ava.va_mask = AT_ALL;
1535 1449          avap = VOP_GETATTR(vp, &ava, 0, cr, &ct) ? NULL : &ava;
1536 1450  
1537      -#ifdef DEBUG
1538      -        if (!rfs3_do_post_op_attr)
1539      -                avap = NULL;
1540      -#endif
1541      -
1542 1451          if (error)
1543 1452                  goto err;
1544 1453  
1545 1454          /*
1546 1455           * If we were unable to get the V_WRITELOCK_TRUE, then we
1547 1456           * may not have accurate after attrs, so check if
1548 1457           * we have both attributes, they have a non-zero va_seq, and
1549 1458           * va_seq has changed by exactly one,
1550 1459           * if not, turn off the before attr.
1551 1460           */
↓ open down ↓ 68 lines elided ↑ open up ↑
1620 1529          dvp = nfs3_fhtovp(&args->where.dir, exi);
1621 1530  
1622 1531          DTRACE_NFSV3_4(op__create__start, struct svc_req *, req,
1623 1532              cred_t *, cr, vnode_t *, dvp, CREATE3args *, args);
1624 1533  
1625 1534          if (dvp == NULL) {
1626 1535                  error = ESTALE;
1627 1536                  goto out;
1628 1537          }
1629 1538  
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 1539          dbva.va_mask = AT_ALL;
1638 1540          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
1639      -#endif
1640 1541          davap = dbvap;
1641 1542  
1642 1543          if (args->where.name == nfs3nametoolong) {
1643 1544                  resp->status = NFS3ERR_NAMETOOLONG;
1644 1545                  goto out1;
1645 1546          }
1646 1547  
1647 1548          if (args->where.name == NULL || *(args->where.name) == '\0') {
1648 1549                  resp->status = NFS3ERR_ACCES;
1649 1550                  goto out1;
↓ open down ↓ 142 lines elided ↑ open up ↑
1792 1693  tryagain:
1793 1694          /*
1794 1695           * The file open mode used is VWRITE.  If the client needs
1795 1696           * some other semantic, then it should do the access checking
1796 1697           * itself.  It would have been nice to have the file open mode
1797 1698           * passed as part of the arguments.
1798 1699           */
1799 1700          error = VOP_CREATE(dvp, name, &va, excl, VWRITE,
1800 1701              &vp, cr, 0, NULL, NULL);
1801 1702  
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 1703          dava.va_mask = AT_ALL;
1810 1704          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
1811      -#endif
1812 1705  
1813 1706          if (error) {
1814 1707                  /*
1815 1708                   * If we got something other than file already exists
1816 1709                   * then just return this error.  Otherwise, we got
1817 1710                   * EEXIST.  If we were doing a GUARDED create, then
1818 1711                   * just return this error.  Otherwise, we need to
1819 1712                   * make sure that this wasn't a duplicate of an
1820 1713                   * exclusive create request.
1821 1714                   *
↓ open down ↓ 83 lines elided ↑ open up ↑
1905 1798                          va.va_size = reqsize;
1906 1799                          (void) VOP_SETATTR(vp, &va, 0, cr, NULL);
1907 1800                          va.va_mask = AT_ALL;
1908 1801                          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
1909 1802                  }
1910 1803          }
1911 1804  
1912 1805          if (name != args->where.name)
1913 1806                  kmem_free(name, MAXPATHLEN + 1);
1914 1807  
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 1808          error = makefh3(&resp->resok.obj.handle, vp, exi);
1926 1809          if (error)
1927 1810                  resp->resok.obj.handle_follows = FALSE;
1928 1811          else
1929 1812                  resp->resok.obj.handle_follows = TRUE;
1930      -#ifdef DEBUG
1931      -        }
1932      -#endif
1933 1813  
1934 1814          /*
1935 1815           * Force modified data and metadata out to stable storage.
1936 1816           */
1937 1817          (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
1938 1818          (void) VOP_FSYNC(dvp, 0, cr, NULL);
1939 1819  
1940 1820          VN_RELE(vp);
1941 1821          if (tvp != NULL) {
1942 1822                  if (in_crit)
↓ open down ↓ 63 lines elided ↑ open up ↑
2006 1886          dvp = nfs3_fhtovp(&args->where.dir, exi);
2007 1887  
2008 1888          DTRACE_NFSV3_4(op__mkdir__start, struct svc_req *, req,
2009 1889              cred_t *, cr, vnode_t *, dvp, MKDIR3args *, args);
2010 1890  
2011 1891          if (dvp == NULL) {
2012 1892                  error = ESTALE;
2013 1893                  goto out;
2014 1894          }
2015 1895  
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 1896          dbva.va_mask = AT_ALL;
2024 1897          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2025      -#endif
2026 1898          davap = dbvap;
2027 1899  
2028 1900          if (args->where.name == nfs3nametoolong) {
2029 1901                  resp->status = NFS3ERR_NAMETOOLONG;
2030 1902                  goto out1;
2031 1903          }
2032 1904  
2033 1905          if (args->where.name == NULL || *(args->where.name) == '\0') {
2034 1906                  resp->status = NFS3ERR_ACCES;
2035 1907                  goto out1;
↓ open down ↓ 39 lines elided ↑ open up ↑
2075 1947          }
2076 1948  
2077 1949          va.va_mask |= AT_TYPE;
2078 1950          va.va_type = VDIR;
2079 1951  
2080 1952          error = VOP_MKDIR(dvp, name, &va, &vp, cr, NULL, 0, NULL);
2081 1953  
2082 1954          if (name != args->where.name)
2083 1955                  kmem_free(name, MAXPATHLEN + 1);
2084 1956  
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 1957          dava.va_mask = AT_ALL;
2093 1958          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2094      -#endif
2095 1959  
2096 1960          /*
2097 1961           * Force modified data and metadata out to stable storage.
2098 1962           */
2099 1963          (void) VOP_FSYNC(dvp, 0, cr, NULL);
2100 1964  
2101 1965          if (error)
2102 1966                  goto out;
2103 1967  
2104      -#ifdef DEBUG
2105      -        if (!rfs3_do_post_op_fh3)
2106      -                resp->resok.obj.handle_follows = FALSE;
2107      -        else {
2108      -#endif
2109 1968          error = makefh3(&resp->resok.obj.handle, vp, exi);
2110 1969          if (error)
2111 1970                  resp->resok.obj.handle_follows = FALSE;
2112 1971          else
2113 1972                  resp->resok.obj.handle_follows = TRUE;
2114      -#ifdef DEBUG
2115      -        }
2116      -#endif
2117 1973  
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 1974          va.va_mask = AT_ALL;
2126 1975          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2127      -#endif
2128 1976  
2129 1977          /*
2130 1978           * Force modified data and metadata out to stable storage.
2131 1979           */
2132 1980          (void) VOP_FSYNC(vp, 0, cr, NULL);
2133 1981  
2134 1982          VN_RELE(vp);
2135 1983  
2136 1984          resp->status = NFS3_OK;
2137 1985          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
↓ open down ↓ 49 lines elided ↑ open up ↑
2187 2035          dvp = nfs3_fhtovp(&args->where.dir, exi);
2188 2036  
2189 2037          DTRACE_NFSV3_4(op__symlink__start, struct svc_req *, req,
2190 2038              cred_t *, cr, vnode_t *, dvp, SYMLINK3args *, args);
2191 2039  
2192 2040          if (dvp == NULL) {
2193 2041                  error = ESTALE;
2194 2042                  goto err;
2195 2043          }
2196 2044  
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 2045          dbva.va_mask = AT_ALL;
2205 2046          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2206      -#endif
2207 2047          davap = dbvap;
2208 2048  
2209 2049          if (args->where.name == nfs3nametoolong) {
2210 2050                  resp->status = NFS3ERR_NAMETOOLONG;
2211 2051                  goto err1;
2212 2052          }
2213 2053  
2214 2054          if (args->where.name == NULL || *(args->where.name) == '\0') {
2215 2055                  resp->status = NFS3ERR_ACCES;
2216 2056                  goto err1;
↓ open down ↓ 51 lines elided ↑ open up ↑
2268 2108                  resp->status = NFS3ERR_INVAL;
2269 2109                  goto err1;
2270 2110          }
2271 2111  
2272 2112  
2273 2113          va.va_mask |= AT_TYPE;
2274 2114          va.va_type = VLNK;
2275 2115  
2276 2116          error = VOP_SYMLINK(dvp, name, &va, symdata, cr, NULL, 0);
2277 2117  
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 2118          dava.va_mask = AT_ALL;
2286 2119          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2287      -#endif
2288 2120  
2289 2121          if (error)
2290 2122                  goto err;
2291 2123  
2292 2124          error = VOP_LOOKUP(dvp, name, &vp, NULL, 0, NULL, cr,
2293 2125              NULL, NULL, NULL);
2294 2126  
2295 2127          /*
2296 2128           * Force modified data and metadata out to stable storage.
2297 2129           */
↓ open down ↓ 1 lines elided ↑ open up ↑
2299 2131  
2300 2132  
2301 2133          resp->status = NFS3_OK;
2302 2134          if (error) {
2303 2135                  resp->resok.obj.handle_follows = FALSE;
2304 2136                  vattr_to_post_op_attr(NULL, &resp->resok.obj_attributes);
2305 2137                  vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
2306 2138                  goto out;
2307 2139          }
2308 2140  
2309      -#ifdef DEBUG
2310      -        if (!rfs3_do_post_op_fh3)
2311      -                resp->resok.obj.handle_follows = FALSE;
2312      -        else {
2313      -#endif
2314 2141          error = makefh3(&resp->resok.obj.handle, vp, exi);
2315 2142          if (error)
2316 2143                  resp->resok.obj.handle_follows = FALSE;
2317 2144          else
2318 2145                  resp->resok.obj.handle_follows = TRUE;
2319      -#ifdef DEBUG
2320      -        }
2321      -#endif
2322 2146  
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 2147          va.va_mask = AT_ALL;
2331 2148          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2332      -#endif
2333 2149  
2334 2150          /*
2335 2151           * Force modified data and metadata out to stable storage.
2336 2152           */
2337 2153          (void) VOP_FSYNC(vp, 0, cr, NULL);
2338 2154  
2339 2155          VN_RELE(vp);
2340 2156  
2341 2157          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
2342 2158          vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
↓ open down ↓ 52 lines elided ↑ open up ↑
2395 2211          dvp = nfs3_fhtovp(&args->where.dir, exi);
2396 2212  
2397 2213          DTRACE_NFSV3_4(op__mknod__start, struct svc_req *, req,
2398 2214              cred_t *, cr, vnode_t *, dvp, MKNOD3args *, args);
2399 2215  
2400 2216          if (dvp == NULL) {
2401 2217                  error = ESTALE;
2402 2218                  goto out;
2403 2219          }
2404 2220  
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 2221          dbva.va_mask = AT_ALL;
2413 2222          dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
2414      -#endif
2415 2223          davap = dbvap;
2416 2224  
2417 2225          if (args->where.name == nfs3nametoolong) {
2418 2226                  resp->status = NFS3ERR_NAMETOOLONG;
2419 2227                  goto out1;
2420 2228          }
2421 2229  
2422 2230          if (args->where.name == NULL || *(args->where.name) == '\0') {
2423 2231                  resp->status = NFS3ERR_ACCES;
2424 2232                  goto out1;
↓ open down ↓ 81 lines elided ↑ open up ↑
2506 2314          excl = EXCL;
2507 2315  
2508 2316          mode = 0;
2509 2317  
2510 2318          error = VOP_CREATE(dvp, name, &va, excl, mode,
2511 2319              &vp, cr, 0, NULL, NULL);
2512 2320  
2513 2321          if (name != args->where.name)
2514 2322                  kmem_free(name, MAXPATHLEN + 1);
2515 2323  
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 2324          dava.va_mask = AT_ALL;
2524 2325          davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
2525      -#endif
2526 2326  
2527 2327          /*
2528 2328           * Force modified data and metadata out to stable storage.
2529 2329           */
2530 2330          (void) VOP_FSYNC(dvp, 0, cr, NULL);
2531 2331  
2532 2332          if (error)
2533 2333                  goto out;
2534 2334  
2535 2335          resp->status = NFS3_OK;
2536 2336  
2537      -#ifdef DEBUG
2538      -        if (!rfs3_do_post_op_fh3)
2539      -                resp->resok.obj.handle_follows = FALSE;
2540      -        else {
2541      -#endif
2542 2337          error = makefh3(&resp->resok.obj.handle, vp, exi);
2543 2338          if (error)
2544 2339                  resp->resok.obj.handle_follows = FALSE;
2545 2340          else
2546 2341                  resp->resok.obj.handle_follows = TRUE;
2547      -#ifdef DEBUG
2548      -        }
2549      -#endif
2550 2342  
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 2343          va.va_mask = AT_ALL;
2559 2344          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
2560      -#endif
2561 2345  
2562 2346          /*
2563 2347           * Force modified metadata out to stable storage.
2564 2348           *
2565 2349           * if a underlying vp exists, pass it to VOP_FSYNC
2566 2350           */
2567 2351          if (VOP_REALVP(vp, &realvp, NULL) == 0)
2568 2352                  (void) VOP_FSYNC(realvp, FNODSYNC, cr, NULL);
2569 2353          else
2570 2354                  (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
↓ open down ↓ 48 lines elided ↑ open up ↑
2619 2403          vp = nfs3_fhtovp(&args->object.dir, exi);
2620 2404  
2621 2405          DTRACE_NFSV3_4(op__remove__start, struct svc_req *, req,
2622 2406              cred_t *, cr, vnode_t *, vp, REMOVE3args *, args);
2623 2407  
2624 2408          if (vp == NULL) {
2625 2409                  error = ESTALE;
2626 2410                  goto err;
2627 2411          }
2628 2412  
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 2413          bva.va_mask = AT_ALL;
2637 2414          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2638      -#endif
2639 2415          avap = bvap;
2640 2416  
2641 2417          if (vp->v_type != VDIR) {
2642 2418                  resp->status = NFS3ERR_NOTDIR;
2643 2419                  goto err1;
2644 2420          }
2645 2421  
2646 2422          if (args->object.name == nfs3nametoolong) {
2647 2423                  resp->status = NFS3ERR_NAMETOOLONG;
2648 2424                  goto err1;
↓ open down ↓ 55 lines elided ↑ open up ↑
2704 2480                  if (nbl_conflict(targvp, NBL_REMOVE, 0, 0, 0, NULL)) {
2705 2481                          error = EACCES;
2706 2482                  } else {
2707 2483                          error = VOP_REMOVE(vp, name, cr, NULL, 0);
2708 2484                  }
2709 2485                  nbl_end_crit(targvp);
2710 2486          }
2711 2487          VN_RELE(targvp);
2712 2488          targvp = NULL;
2713 2489  
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 2490          ava.va_mask = AT_ALL;
2722 2491          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2723      -#endif
2724 2492  
2725 2493          /*
2726 2494           * Force modified data and metadata out to stable storage.
2727 2495           */
2728 2496          (void) VOP_FSYNC(vp, 0, cr, NULL);
2729 2497  
2730 2498          if (error)
2731 2499                  goto err;
2732 2500  
2733 2501          resp->status = NFS3_OK;
↓ open down ↓ 45 lines elided ↑ open up ↑
2779 2547          vp = nfs3_fhtovp(&args->object.dir, exi);
2780 2548  
2781 2549          DTRACE_NFSV3_4(op__rmdir__start, struct svc_req *, req,
2782 2550              cred_t *, cr, vnode_t *, vp, RMDIR3args *, args);
2783 2551  
2784 2552          if (vp == NULL) {
2785 2553                  error = ESTALE;
2786 2554                  goto err;
2787 2555          }
2788 2556  
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 2557          bva.va_mask = AT_ALL;
2797 2558          bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
2798      -#endif
2799 2559          avap = bvap;
2800 2560  
2801 2561          if (vp->v_type != VDIR) {
2802 2562                  resp->status = NFS3ERR_NOTDIR;
2803 2563                  goto err1;
2804 2564          }
2805 2565  
2806 2566          if (args->object.name == nfs3nametoolong) {
2807 2567                  resp->status = NFS3ERR_NAMETOOLONG;
2808 2568                  goto err1;
↓ open down ↓ 32 lines elided ↑ open up ↑
2841 2601          if (name == NULL) {
2842 2602                  resp->status = NFS3ERR_INVAL;
2843 2603                  goto err1;
2844 2604          }
2845 2605  
2846 2606          error = VOP_RMDIR(vp, name, rootdir, cr, NULL, 0);
2847 2607  
2848 2608          if (name != args->object.name)
2849 2609                  kmem_free(name, MAXPATHLEN + 1);
2850 2610  
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 2611          ava.va_mask = AT_ALL;
2859 2612          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
2860      -#endif
2861 2613  
2862 2614          /*
2863 2615           * Force modified data and metadata out to stable storage.
2864 2616           */
2865 2617          (void) VOP_FSYNC(vp, 0, cr, NULL);
2866 2618  
2867 2619          if (error) {
2868 2620                  /*
2869 2621                   * System V defines rmdir to return EEXIST, not ENOTEMPTY,
2870 2622                   * if the directory is not empty.  A System V NFS server
↓ open down ↓ 80 lines elided ↑ open up ↑
2951 2703  
2952 2704                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
2953 2705                          if (!do_rfs_label_check(clabel, fvp, EQUALITY_CHECK,
2954 2706                              exi)) {
2955 2707                                  resp->status = NFS3ERR_ACCES;
2956 2708                                  goto err1;
2957 2709                          }
2958 2710                  }
2959 2711          }
2960 2712  
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 2713          fbva.va_mask = AT_ALL;
2969 2714          fbvap = VOP_GETATTR(fvp, &fbva, 0, cr, NULL) ? NULL : &fbva;
2970      -#endif
2971 2715          favap = fbvap;
2972 2716  
2973 2717          fh3 = &args->to.dir;
2974 2718          to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
2975 2719          if (to_exi == NULL) {
2976 2720                  resp->status = NFS3ERR_ACCES;
2977 2721                  goto err1;
2978 2722          }
2979 2723          exi_rele(to_exi);
2980 2724  
↓ open down ↓ 1 lines elided ↑ open up ↑
2982 2726                  resp->status = NFS3ERR_XDEV;
2983 2727                  goto err1;
2984 2728          }
2985 2729  
2986 2730          tvp = nfs3_fhtovp(&args->to.dir, exi);
2987 2731          if (tvp == NULL) {
2988 2732                  error = ESTALE;
2989 2733                  goto err;
2990 2734          }
2991 2735  
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 2736          tbva.va_mask = AT_ALL;
3000 2737          tbvap = VOP_GETATTR(tvp, &tbva, 0, cr, NULL) ? NULL : &tbva;
3001      -#endif
3002 2738          tavap = tbvap;
3003 2739  
3004 2740          if (fvp->v_type != VDIR || tvp->v_type != VDIR) {
3005 2741                  resp->status = NFS3ERR_NOTDIR;
3006 2742                  goto err1;
3007 2743          }
3008 2744  
3009 2745          if (args->from.name == nfs3nametoolong ||
3010 2746              args->to.name == nfs3nametoolong) {
3011 2747                  resp->status = NFS3ERR_NAMETOOLONG;
↓ open down ↓ 81 lines elided ↑ open up ↑
3093 2829                  else
3094 2830                          error = VOP_RENAME(fvp, name, tvp, toname, cr, NULL, 0);
3095 2831                  nbl_end_crit(srcvp);
3096 2832          }
3097 2833          if (error == 0)
3098 2834                  vn_renamepath(tvp, srcvp, args->to.name,
3099 2835                      strlen(args->to.name));
3100 2836          VN_RELE(srcvp);
3101 2837          srcvp = NULL;
3102 2838  
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 2839          fava.va_mask = AT_ALL;
3115 2840          favap = VOP_GETATTR(fvp, &fava, 0, cr, NULL) ? NULL : &fava;
3116 2841          tava.va_mask = AT_ALL;
3117 2842          tavap = VOP_GETATTR(tvp, &tava, 0, cr, NULL) ? NULL : &tava;
3118      -#endif
3119 2843  
3120 2844          /*
3121 2845           * Force modified data and metadata out to stable storage.
3122 2846           */
3123 2847          (void) VOP_FSYNC(fvp, 0, cr, NULL);
3124 2848          (void) VOP_FSYNC(tvp, 0, cr, NULL);
3125 2849  
3126 2850          if (error)
3127 2851                  goto err;
3128 2852  
↓ open down ↓ 61 lines elided ↑ open up ↑
3190 2914          vp = nfs3_fhtovp(&args->file, exi);
3191 2915  
3192 2916          DTRACE_NFSV3_4(op__link__start, struct svc_req *, req,
3193 2917              cred_t *, cr, vnode_t *, vp, LINK3args *, args);
3194 2918  
3195 2919          if (vp == NULL) {
3196 2920                  error = ESTALE;
3197 2921                  goto out;
3198 2922          }
3199 2923  
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 2924          va.va_mask = AT_ALL;
3208 2925          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3209      -#endif
3210 2926  
3211 2927          fh3 = &args->link.dir;
3212 2928          to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
3213 2929          if (to_exi == NULL) {
3214 2930                  resp->status = NFS3ERR_ACCES;
3215 2931                  goto out1;
3216 2932          }
3217 2933          exi_rele(to_exi);
3218 2934  
3219 2935          if (to_exi != exi) {
↓ open down ↓ 16 lines elided ↑ open up ↑
3236 2952                          }
3237 2953                  }
3238 2954          }
3239 2955  
3240 2956          dvp = nfs3_fhtovp(&args->link.dir, exi);
3241 2957          if (dvp == NULL) {
3242 2958                  error = ESTALE;
3243 2959                  goto out;
3244 2960          }
3245 2961  
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 2962          bva.va_mask = AT_ALL;
3254 2963          bvap = VOP_GETATTR(dvp, &bva, 0, cr, NULL) ? NULL : &bva;
3255      -#endif
3256 2964  
3257 2965          if (dvp->v_type != VDIR) {
3258 2966                  resp->status = NFS3ERR_NOTDIR;
3259 2967                  goto out1;
3260 2968          }
3261 2969  
3262 2970          if (args->link.name == nfs3nametoolong) {
3263 2971                  resp->status = NFS3ERR_NAMETOOLONG;
3264 2972                  goto out1;
3265 2973          }
↓ open down ↓ 25 lines elided ↑ open up ↑
3291 2999          name = nfscmd_convname(ca, exi, args->link.name,
3292 3000              NFSCMD_CONV_INBOUND, MAXPATHLEN + 1);
3293 3001  
3294 3002          if (name == NULL) {
3295 3003                  resp->status = NFS3ERR_SERVERFAULT;
3296 3004                  goto out1;
3297 3005          }
3298 3006  
3299 3007          error = VOP_LINK(dvp, vp, name, cr, NULL, 0);
3300 3008  
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 3009          va.va_mask = AT_ALL;
3313 3010          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3314 3011          ava.va_mask = AT_ALL;
3315 3012          avap = VOP_GETATTR(dvp, &ava, 0, cr, NULL) ? NULL : &ava;
3316      -#endif
3317 3013  
3318 3014          /*
3319 3015           * Force modified data and metadata out to stable storage.
3320 3016           */
3321 3017          (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);
3322 3018          (void) VOP_FSYNC(dvp, 0, cr, NULL);
3323 3019  
3324 3020          if (error)
3325 3021                  goto out;
3326 3022  
↓ open down ↓ 108 lines elided ↑ open up ↑
3435 3131                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
3436 3132                              exi)) {
3437 3133                                  resp->status = NFS3ERR_ACCES;
3438 3134                                  goto out1;
3439 3135                          }
3440 3136                  }
3441 3137          }
3442 3138  
3443 3139          (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
3444 3140  
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 3141          va.va_mask = AT_ALL;
3453 3142          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3454      -#endif
3455 3143  
3456 3144          if (vp->v_type != VDIR) {
3457 3145                  resp->status = NFS3ERR_NOTDIR;
3458 3146                  goto out1;
3459 3147          }
3460 3148  
3461 3149          error = VOP_ACCESS(vp, VREAD, 0, cr, NULL);
3462 3150          if (error)
3463 3151                  goto out;
3464 3152  
↓ open down ↓ 19 lines elided ↑ open up ↑
3484 3172          iov.iov_len = count;
3485 3173          uio.uio_iov = &iov;
3486 3174          uio.uio_iovcnt = 1;
3487 3175          uio.uio_segflg = UIO_SYSSPACE;
3488 3176          uio.uio_extflg = UIO_COPY_CACHED;
3489 3177          uio.uio_loffset = (offset_t)args->cookie;
3490 3178          uio.uio_resid = count;
3491 3179  
3492 3180          error = VOP_READDIR(vp, &uio, cr, &iseof, NULL, 0);
3493 3181  
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 3182          va.va_mask = AT_ALL;
3502 3183          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3503      -#endif
3504 3184  
3505 3185          if (error) {
3506 3186                  kmem_free(data, count);
3507 3187                  goto out;
3508 3188          }
3509 3189  
3510 3190          /*
3511 3191           * If the count was not large enough to be able to guarantee
3512 3192           * to be able to return at least one entry, then need to
3513 3193           * check to see if NFS3ERR_TOOSMALL should be returned.
↓ open down ↓ 209 lines elided ↑ open up ↑
3723 3403                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
3724 3404                              exi)) {
3725 3405                                  resp->status = NFS3ERR_ACCES;
3726 3406                                  goto out1;
3727 3407                          }
3728 3408                  }
3729 3409          }
3730 3410  
3731 3411          (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
3732 3412  
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 3413          va.va_mask = AT_ALL;
3741 3414          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3742      -#endif
3743 3415  
3744 3416          if (vp->v_type != VDIR) {
3745 3417                  error = ENOTDIR;
3746 3418                  goto out;
3747 3419          }
3748 3420  
3749 3421          error = VOP_ACCESS(vp, VREAD, 0, cr, NULL);
3750 3422          if (error)
3751 3423                  goto out;
3752 3424  
↓ open down ↓ 138 lines elided ↑ open up ↑
3891 3563           * exceeded dircount then go back and get some more.
3892 3564           */
3893 3565          if (!iseof &&
3894 3566              (args->maxcount - bufsize) >= NFS3_READDIRPLUS_ENTRY(MAXNAMELEN)) {
3895 3567                  space_left -= (prev_len - uio.uio_resid);
3896 3568                  if (space_left >= DIRENT64_RECLEN(MAXNAMELEN))
3897 3569                          goto getmoredents;
3898 3570  
3899 3571                  /* else, fall through */
3900 3572          }
3901      -
3902 3573  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 3574          va.va_mask = AT_ALL;
3912 3575          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
3913      -#endif
3914 3576  
3915 3577          VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, NULL);
3916 3578  
3917 3579          infop = kmem_alloc(nents * sizeof (struct entryplus3_info), KM_SLEEP);
3918 3580          resp->resok.infop = infop;
3919 3581  
3920 3582          dp = (struct dirent64 *)data;
3921 3583          for (i = 0; i < nents; i++) {
3922 3584  
3923 3585                  if (dp->d_ino == 0) {
↓ open down ↓ 7 lines elided ↑ open up ↑
3931 3593  
3932 3594                  error = VOP_LOOKUP(vp, dp->d_name, &nvp, NULL, 0, NULL, cr,
3933 3595                      NULL, NULL, NULL);
3934 3596                  if (error) {
3935 3597                          infop[i].attr.attributes = FALSE;
3936 3598                          infop[i].fh.handle_follows = FALSE;
3937 3599                          dp = nextdp(dp);
3938 3600                          continue;
3939 3601                  }
3940 3602  
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 3603                  nva.va_mask = AT_ALL;
3950 3604                  nvap = rfs4_delegated_getattr(nvp, &nva, 0, cr) ? NULL : &nva;
3951      -#endif
     3605 +
3952 3606                  /* Lie about the object type for a referral */
3953 3607                  if (vn_is_nfs_reparse(nvp, cr))
3954 3608                          nvap->va_type = VLNK;
3955 3609  
3956 3610                  vattr_to_post_op_attr(nvap, &infop[i].attr);
3957 3611  
3958      -#ifdef DEBUG
3959      -                if (!rfs3_do_post_op_fh3)
3960      -                        infop[i].fh.handle_follows = FALSE;
3961      -                else {
3962      -#endif
3963 3612                  error = makefh3(&infop[i].fh.handle, nvp, exi);
3964 3613                  if (!error)
3965 3614                          infop[i].fh.handle_follows = TRUE;
3966 3615                  else
3967 3616                          infop[i].fh.handle_follows = FALSE;
3968      -#ifdef DEBUG
3969      -                }
3970      -#endif
3971 3617  
3972 3618                  VN_RELE(nvp);
3973 3619                  dp = nextdp(dp);
3974 3620          }
3975 3621  
3976 3622          ca = (struct sockaddr *)svc_getrpccaller(req->rq_xprt)->buf;
3977 3623          ret = nfscmd_convdirplus(ca, exi, data, nents, args->dircount, &ndata);
3978 3624          if (ndata == NULL)
3979 3625                  ndata = data;
3980 3626  
↓ open down ↓ 118 lines elided ↑ open up ↑
4099 3745                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4100 3746                              exi)) {
4101 3747                                  resp->status = NFS3ERR_ACCES;
4102 3748                                  goto out1;
4103 3749                          }
4104 3750                  }
4105 3751          }
4106 3752  
4107 3753          error = VFS_STATVFS(vp->v_vfsp, &sb);
4108 3754  
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 3755          va.va_mask = AT_ALL;
4117 3756          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4118      -#endif
4119 3757  
4120 3758          if (error)
4121 3759                  goto out;
4122 3760  
4123 3761          resp->status = NFS3_OK;
4124 3762          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
4125 3763          if (sb.f_blocks != (fsblkcnt64_t)-1)
4126 3764                  resp->resok.tbytes = (size3)sb.f_frsize * (size3)sb.f_blocks;
4127 3765          else
4128 3766                  resp->resok.tbytes = (size3)sb.f_blocks;
↓ open down ↓ 75 lines elided ↑ open up ↑
4204 3842                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4205 3843                              exi)) {
4206 3844                                  resp->status = NFS3ERR_STALE;
4207 3845                                  vattr_to_post_op_attr(NULL,
4208 3846                                      &resp->resfail.obj_attributes);
4209 3847                                  goto out;
4210 3848                          }
4211 3849                  }
4212 3850          }
4213 3851  
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 3852          va.va_mask = AT_ALL;
4222 3853          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4223      -#endif
4224 3854  
4225 3855          resp->status = NFS3_OK;
4226 3856          vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
4227 3857          xfer_size = rfs3_tsize(req);
4228 3858          resp->resok.rtmax = xfer_size;
4229 3859          resp->resok.rtpref = xfer_size;
4230 3860          resp->resok.rtmult = DEV_BSIZE;
4231 3861          resp->resok.wtmax = xfer_size;
4232 3862          resp->resok.wtpref = xfer_size;
4233 3863          resp->resok.wtmult = DEV_BSIZE;
↓ open down ↓ 82 lines elided ↑ open up ↑
4316 3946  
4317 3947                  if (!blequal(&l_admin_low->tsl_label, clabel)) {
4318 3948                          if (!do_rfs_label_check(clabel, vp, DOMINANCE_CHECK,
4319 3949                              exi)) {
4320 3950                                  resp->status = NFS3ERR_ACCES;
4321 3951                                  goto out1;
4322 3952                          }
4323 3953                  }
4324 3954          }
4325 3955  
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 3956          va.va_mask = AT_ALL;
4334 3957          vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
4335      -#endif
4336 3958  
4337 3959          error = VOP_PATHCONF(vp, _PC_LINK_MAX, &val, cr, NULL);
4338 3960          if (error)
4339 3961                  goto out;
4340 3962          resp->resok.info.link_max = (uint32)val;
4341 3963  
4342 3964          error = VOP_PATHCONF(vp, _PC_NAME_MAX, &val, cr, NULL);
4343 3965          if (error)
4344 3966                  goto out;
4345 3967          resp->resok.info.name_max = (uint32)val;
↓ open down ↓ 71 lines elided ↑ open up ↑
4417 4039          bva.va_mask = AT_ALL;
4418 4040          error = VOP_GETATTR(vp, &bva, 0, cr, NULL);
4419 4041  
4420 4042          /*
4421 4043           * If we can't get the attributes, then we can't do the
4422 4044           * right access checking.  So, we'll fail the request.
4423 4045           */
4424 4046          if (error)
4425 4047                  goto out;
4426 4048  
4427      -#ifdef DEBUG
4428      -        if (rfs3_do_pre_op_attr)
4429      -                bvap = &bva;
4430      -        else
4431      -                bvap = NULL;
4432      -#else
4433 4049          bvap = &bva;
4434      -#endif
4435 4050  
4436 4051          if (rdonly(exi, req)) {
4437 4052                  resp->status = NFS3ERR_ROFS;
4438 4053                  goto out1;
4439 4054          }
4440 4055  
4441 4056          if (vp->v_type != VREG) {
4442 4057                  resp->status = NFS3ERR_INVAL;
4443 4058                  goto out1;
4444 4059          }
↓ open down ↓ 13 lines elided ↑ open up ↑
4458 4073                          }
4459 4074                  }
4460 4075          }
4461 4076  
4462 4077          if (crgetuid(cr) != bva.va_uid &&
4463 4078              (error = VOP_ACCESS(vp, VWRITE, 0, cr, NULL)))
4464 4079                  goto out;
4465 4080  
4466 4081          error = VOP_FSYNC(vp, FSYNC, cr, NULL);
4467 4082  
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 4083          ava.va_mask = AT_ALL;
4476 4084          avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
4477      -#endif
4478 4085  
4479 4086          if (error)
4480 4087                  goto out;
4481 4088  
4482 4089          resp->status = NFS3_OK;
4483 4090          vattr_to_wcc_data(bvap, avap, &resp->resok.file_wcc);
4484 4091          resp->resok.verf = write3verf;
4485 4092  
4486 4093          DTRACE_NFSV3_4(op__commit__done, struct svc_req *, req,
4487 4094              cred_t *, cr, vnode_t *, vp, COMMIT3res *, resp);
↓ open down ↓ 248 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX