Print this page
*** NO COMMENTS ***

@@ -69,16 +69,10 @@
  * These are the interface routines for the server side of the
  * Network File System.  See the NFS version 3 protocol specification
  * for a description of this interface.
  */
 
-#ifdef DEBUG
-int rfs3_do_pre_op_attr = 1;
-int rfs3_do_post_op_attr = 1;
-int rfs3_do_post_op_fh3 = 1;
-#endif
-
 static writeverf3 write3verf;
 
 static int      sattr3_to_vattr(sattr3 *, struct vattr *);
 static int      vattr_to_fattr3(struct vattr *, fattr3 *);
 static int      vattr_to_wcc_attr(struct vattr *, wcc_attr *);

@@ -225,16 +219,11 @@
          * right access checking.  So, we'll fail the request.
          */
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr)
-                bvap = &bva;
-#else
         bvap = &bva;
-#endif
 
         if (rdonly(exi, req) || vn_is_readonly(vp)) {
                 resp->status = NFS3ERR_ROFS;
                 goto out1;
         }

@@ -320,20 +309,12 @@
         if (error == EAGAIN && (ct.cc_flags & CC_WOULDBLOCK)) {
                 resp->status = NFS3ERR_JUKEBOX;
                 goto out1;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 ava.va_mask = AT_ALL;
                 avap = rfs4_delegated_getattr(vp, &ava, 0, cr) ? NULL : &ava;
-        } else
-                avap = NULL;
-#else
-        ava.va_mask = AT_ALL;
-        avap = rfs4_delegated_getattr(vp, &ava, 0, cr) ? NULL : &ava;
-#endif
 
         /*
          * Force modified metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, FNODSYNC, cr, &ct);

@@ -419,19 +400,12 @@
                         error = ESTALE;
                         goto out;
                 }
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
                 dva.va_mask = AT_ALL;
                 dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
-        }
-#else
-        dva.va_mask = AT_ALL;
-        dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
-#endif
 
         if (args->what.name == nfs3nametoolong) {
                 resp->status = NFS3ERR_NAMETOOLONG;
                 goto out1;
         }

@@ -522,20 +496,12 @@
                                 error = 1;
                         }
                 }
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                dva.va_mask = AT_ALL;
-                dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
-        } else
-                dvap = NULL;
-#else
         dva.va_mask = AT_ALL;
         dvap = VOP_GETATTR(dvp, &dva, 0, cr, NULL) ? NULL : &dva;
-#endif
 
         if (error)
                 goto out;
 
         if (sec.sec_flags & SEC_QUERY) {

@@ -558,20 +524,12 @@
          * will be released by the caller, common_dispatch.
          */
         if (publicfh_flag)
                 exi_rele(exi);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
-#endif
 
         VN_RELE(vp);
 
         resp->status = NFS3_OK;
         vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);

@@ -660,16 +618,11 @@
         va.va_mask = AT_MODE;
         error = VOP_GETATTR(vp, &va, 0, cr, NULL);
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr)
-                vap = &va;
-#else
         vap = &va;
-#endif
 
         resp->resok.access = 0;
 
         if (is_system_labeled()) {
                 bslabel_t *clabel = req->rq_label;

@@ -740,20 +693,12 @@
                     (!is_system_labeled() || admin_low_client ||
                     dominant_label))
                         resp->resok.access |= ACCESS3_EXECUTE;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;
-#endif
 
         resp->status = NFS3_OK;
         vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
 
         DTRACE_NFSV3_4(op__access__done, struct svc_req *, req,

@@ -814,16 +759,11 @@
         va.va_mask = AT_ALL;
         error = VOP_GETATTR(vp, &va, 0, cr, NULL);
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr)
-                vap = &va;
-#else
         vap = &va;
-#endif
 
         /* We lied about the object type for a referral */
         if (vn_is_nfs_reparse(vp, cr))
                 is_referral = 1;
 

@@ -887,20 +827,13 @@
 
                 if (!error)
                         *(data + MAXPATHLEN - uio.uio_resid) = '\0';
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                va.va_mask = AT_ALL;
-                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
         va.va_mask = AT_ALL;
         vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
+
         /* Lie about object type again just to be consistent */
         if (is_referral && vap != NULL)
                 vap->va_type = VLNK;
 
 #if 0 /* notyet */

@@ -1075,16 +1008,11 @@
          * right access checking.  So, we'll fail the request.
          */
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr)
-                vap = &va;
-#else
         vap = &va;
-#endif
 
         if (vp->v_type != VREG) {
                 resp->status = NFS3ERR_INVAL;
                 goto out1;
         }

@@ -1230,24 +1158,14 @@
         }
 
         va.va_mask = AT_ALL;
         error = VOP_GETATTR(vp, &va, 0, cr, &ct);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 if (error)
                         vap = NULL;
                 else
                         vap = &va;
-        } else
-                vap = NULL;
-#else
-        if (error)
-                vap = NULL;
-        else
-                vap = &va;
-#endif
 
         VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, &ct);
 
         if (in_crit)
                 nbl_end_crit(vp);

@@ -1417,14 +1335,10 @@
          */
         if (error)
                 goto err;
 
         bvap = &bva;
-#ifdef DEBUG
-        if (!rfs3_do_pre_op_attr)
-                bvap = NULL;
-#endif
         avap = bvap;
 
         if (args->count != args->data.data_len) {
                 resp->status = NFS3ERR_INVAL;
                 goto err1;

@@ -1532,15 +1446,10 @@
         }
 
         ava.va_mask = AT_ALL;
         avap = VOP_GETATTR(vp, &ava, 0, cr, &ct) ? NULL : &ava;
 
-#ifdef DEBUG
-        if (!rfs3_do_post_op_attr)
-                avap = NULL;
-#endif
-
         if (error)
                 goto err;
 
         /*
          * If we were unable to get the V_WRITELOCK_TRUE, then we

@@ -1625,20 +1534,12 @@
         if (dvp == NULL) {
                 error = ESTALE;
                 goto out;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                dbva.va_mask = AT_ALL;
-                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-        } else
-                dbvap = NULL;
-#else
         dbva.va_mask = AT_ALL;
         dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-#endif
         davap = dbvap;
 
         if (args->where.name == nfs3nametoolong) {
                 resp->status = NFS3ERR_NAMETOOLONG;
                 goto out1;

@@ -1797,20 +1698,12 @@
          * passed as part of the arguments.
          */
         error = VOP_CREATE(dvp, name, &va, excl, VWRITE,
             &vp, cr, 0, NULL, NULL);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                dava.va_mask = AT_ALL;
-                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-        } else
-                davap = NULL;
-#else
         dava.va_mask = AT_ALL;
         davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-#endif
 
         if (error) {
                 /*
                  * If we got something other than file already exists
                  * then just return this error.  Otherwise, we got

@@ -1910,28 +1803,15 @@
         }
 
         if (name != args->where.name)
                 kmem_free(name, MAXPATHLEN + 1);
 
-#ifdef DEBUG
-        if (!rfs3_do_post_op_attr)
-                vap = NULL;
-#endif
-
-#ifdef DEBUG
-        if (!rfs3_do_post_op_fh3)
-                resp->resok.obj.handle_follows = FALSE;
-        else {
-#endif
         error = makefh3(&resp->resok.obj.handle, vp, exi);
         if (error)
                 resp->resok.obj.handle_follows = FALSE;
         else
                 resp->resok.obj.handle_follows = TRUE;
-#ifdef DEBUG
-        }
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);

@@ -2011,20 +1891,12 @@
         if (dvp == NULL) {
                 error = ESTALE;
                 goto out;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                dbva.va_mask = AT_ALL;
-                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-        } else
-                dbvap = NULL;
-#else
         dbva.va_mask = AT_ALL;
         dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-#endif
         davap = dbvap;
 
         if (args->where.name == nfs3nametoolong) {
                 resp->status = NFS3ERR_NAMETOOLONG;
                 goto out1;

@@ -2080,53 +1952,29 @@
         error = VOP_MKDIR(dvp, name, &va, &vp, cr, NULL, 0, NULL);
 
         if (name != args->where.name)
                 kmem_free(name, MAXPATHLEN + 1);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                dava.va_mask = AT_ALL;
-                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-        } else
-                davap = NULL;
-#else
         dava.va_mask = AT_ALL;
         davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(dvp, 0, cr, NULL);
 
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (!rfs3_do_post_op_fh3)
-                resp->resok.obj.handle_follows = FALSE;
-        else {
-#endif
         error = makefh3(&resp->resok.obj.handle, vp, exi);
         if (error)
                 resp->resok.obj.handle_follows = FALSE;
         else
                 resp->resok.obj.handle_follows = TRUE;
-#ifdef DEBUG
-        }
-#endif
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                va.va_mask = AT_ALL;
-                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
         va.va_mask = AT_ALL;
         vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, 0, cr, NULL);

@@ -2192,20 +2040,12 @@
         if (dvp == NULL) {
                 error = ESTALE;
                 goto err;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                dbva.va_mask = AT_ALL;
-                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-        } else
-                dbvap = NULL;
-#else
         dbva.va_mask = AT_ALL;
         dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-#endif
         davap = dbvap;
 
         if (args->where.name == nfs3nametoolong) {
                 resp->status = NFS3ERR_NAMETOOLONG;
                 goto err1;

@@ -2273,20 +2113,12 @@
         va.va_mask |= AT_TYPE;
         va.va_type = VLNK;
 
         error = VOP_SYMLINK(dvp, name, &va, symdata, cr, NULL, 0);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 dava.va_mask = AT_ALL;
                 davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-        } else
-                davap = NULL;
-#else
-        dava.va_mask = AT_ALL;
-        davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-#endif
 
         if (error)
                 goto err;
 
         error = VOP_LOOKUP(dvp, name, &vp, NULL, 0, NULL, cr,

@@ -2304,34 +2136,18 @@
                 vattr_to_post_op_attr(NULL, &resp->resok.obj_attributes);
                 vattr_to_wcc_data(dbvap, davap, &resp->resok.dir_wcc);
                 goto out;
         }
 
-#ifdef DEBUG
-        if (!rfs3_do_post_op_fh3)
-                resp->resok.obj.handle_follows = FALSE;
-        else {
-#endif
         error = makefh3(&resp->resok.obj.handle, vp, exi);
         if (error)
                 resp->resok.obj.handle_follows = FALSE;
         else
                 resp->resok.obj.handle_follows = TRUE;
-#ifdef DEBUG
-        }
-#endif
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, 0, cr, NULL);

@@ -2400,20 +2216,12 @@
         if (dvp == NULL) {
                 error = ESTALE;
                 goto out;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                dbva.va_mask = AT_ALL;
-                dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-        } else
-                dbvap = NULL;
-#else
         dbva.va_mask = AT_ALL;
         dbvap = VOP_GETATTR(dvp, &dbva, 0, cr, NULL) ? NULL : &dbva;
-#endif
         davap = dbvap;
 
         if (args->where.name == nfs3nametoolong) {
                 resp->status = NFS3ERR_NAMETOOLONG;
                 goto out1;

@@ -2511,20 +2319,12 @@
             &vp, cr, 0, NULL, NULL);
 
         if (name != args->where.name)
                 kmem_free(name, MAXPATHLEN + 1);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                dava.va_mask = AT_ALL;
-                davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-        } else
-                davap = NULL;
-#else
         dava.va_mask = AT_ALL;
         davap = VOP_GETATTR(dvp, &dava, 0, cr, NULL) ? NULL : &dava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(dvp, 0, cr, NULL);

@@ -2532,34 +2332,18 @@
         if (error)
                 goto out;
 
         resp->status = NFS3_OK;
 
-#ifdef DEBUG
-        if (!rfs3_do_post_op_fh3)
-                resp->resok.obj.handle_follows = FALSE;
-        else {
-#endif
         error = makefh3(&resp->resok.obj.handle, vp, exi);
         if (error)
                 resp->resok.obj.handle_follows = FALSE;
         else
                 resp->resok.obj.handle_follows = TRUE;
-#ifdef DEBUG
-        }
-#endif
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         /*
          * Force modified metadata out to stable storage.
          *
          * if a underlying vp exists, pass it to VOP_FSYNC

@@ -2624,20 +2408,12 @@
         if (vp == NULL) {
                 error = ESTALE;
                 goto err;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                bva.va_mask = AT_ALL;
-                bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
-        } else
-                bvap = NULL;
-#else
         bva.va_mask = AT_ALL;
         bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
-#endif
         avap = bvap;
 
         if (vp->v_type != VDIR) {
                 resp->status = NFS3ERR_NOTDIR;
                 goto err1;

@@ -2709,20 +2485,12 @@
                 nbl_end_crit(targvp);
         }
         VN_RELE(targvp);
         targvp = NULL;
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                ava.va_mask = AT_ALL;
-                avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-        } else
-                avap = NULL;
-#else
         ava.va_mask = AT_ALL;
         avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, 0, cr, NULL);

@@ -2784,20 +2552,12 @@
         if (vp == NULL) {
                 error = ESTALE;
                 goto err;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
                 bva.va_mask = AT_ALL;
                 bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
-        } else
-                bvap = NULL;
-#else
-        bva.va_mask = AT_ALL;
-        bvap = VOP_GETATTR(vp, &bva, 0, cr, NULL) ? NULL : &bva;
-#endif
         avap = bvap;
 
         if (vp->v_type != VDIR) {
                 resp->status = NFS3ERR_NOTDIR;
                 goto err1;

@@ -2846,20 +2606,12 @@
         error = VOP_RMDIR(vp, name, rootdir, cr, NULL, 0);
 
         if (name != args->object.name)
                 kmem_free(name, MAXPATHLEN + 1);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 ava.va_mask = AT_ALL;
                 avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-        } else
-                avap = NULL;
-#else
-        ava.va_mask = AT_ALL;
-        avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, 0, cr, NULL);

@@ -2956,20 +2708,12 @@
                                 goto err1;
                         }
                 }
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                fbva.va_mask = AT_ALL;
-                fbvap = VOP_GETATTR(fvp, &fbva, 0, cr, NULL) ? NULL : &fbva;
-        } else
-                fbvap = NULL;
-#else
         fbva.va_mask = AT_ALL;
         fbvap = VOP_GETATTR(fvp, &fbva, 0, cr, NULL) ? NULL : &fbva;
-#endif
         favap = fbvap;
 
         fh3 = &args->to.dir;
         to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
         if (to_exi == NULL) {

@@ -2987,20 +2731,12 @@
         if (tvp == NULL) {
                 error = ESTALE;
                 goto err;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
                 tbva.va_mask = AT_ALL;
                 tbvap = VOP_GETATTR(tvp, &tbva, 0, cr, NULL) ? NULL : &tbva;
-        } else
-                tbvap = NULL;
-#else
-        tbva.va_mask = AT_ALL;
-        tbvap = VOP_GETATTR(tvp, &tbva, 0, cr, NULL) ? NULL : &tbva;
-#endif
         tavap = tbvap;
 
         if (fvp->v_type != VDIR || tvp->v_type != VDIR) {
                 resp->status = NFS3ERR_NOTDIR;
                 goto err1;

@@ -3098,26 +2834,14 @@
                 vn_renamepath(tvp, srcvp, args->to.name,
                     strlen(args->to.name));
         VN_RELE(srcvp);
         srcvp = NULL;
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 fava.va_mask = AT_ALL;
                 favap = VOP_GETATTR(fvp, &fava, 0, cr, NULL) ? NULL : &fava;
                 tava.va_mask = AT_ALL;
                 tavap = VOP_GETATTR(tvp, &tava, 0, cr, NULL) ? NULL : &tava;
-        } else {
-                favap = NULL;
-                tavap = NULL;
-        }
-#else
-        fava.va_mask = AT_ALL;
-        favap = VOP_GETATTR(fvp, &fava, 0, cr, NULL) ? NULL : &fava;
-        tava.va_mask = AT_ALL;
-        tavap = VOP_GETATTR(tvp, &tava, 0, cr, NULL) ? NULL : &tava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(fvp, 0, cr, NULL);

@@ -3195,20 +2919,12 @@
         if (vp == NULL) {
                 error = ESTALE;
                 goto out;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         fh3 = &args->link.dir;
         to_exi = checkexport(&fh3->fh3_fsid, FH3TOXFIDP(fh3));
         if (to_exi == NULL) {
                 resp->status = NFS3ERR_ACCES;

@@ -3241,20 +2957,12 @@
         if (dvp == NULL) {
                 error = ESTALE;
                 goto out;
         }
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                bva.va_mask = AT_ALL;
-                bvap = VOP_GETATTR(dvp, &bva, 0, cr, NULL) ? NULL : &bva;
-        } else
-                bvap = NULL;
-#else
         bva.va_mask = AT_ALL;
         bvap = VOP_GETATTR(dvp, &bva, 0, cr, NULL) ? NULL : &bva;
-#endif
 
         if (dvp->v_type != VDIR) {
                 resp->status = NFS3ERR_NOTDIR;
                 goto out1;
         }

@@ -3296,26 +3004,14 @@
                 goto out1;
         }
 
         error = VOP_LINK(dvp, vp, name, cr, NULL, 0);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
                 ava.va_mask = AT_ALL;
                 avap = VOP_GETATTR(dvp, &ava, 0, cr, NULL) ? NULL : &ava;
-        } else {
-                vap = NULL;
-                avap = NULL;
-        }
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        ava.va_mask = AT_ALL;
-        avap = VOP_GETATTR(dvp, &ava, 0, cr, NULL) ? NULL : &ava;
-#endif
 
         /*
          * Force modified data and metadata out to stable storage.
          */
         (void) VOP_FSYNC(vp, FNODSYNC, cr, NULL);

@@ -3440,20 +3136,12 @@
                 }
         }
 
         (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         if (vp->v_type != VDIR) {
                 resp->status = NFS3ERR_NOTDIR;
                 goto out1;
         }

@@ -3489,20 +3177,12 @@
         uio.uio_loffset = (offset_t)args->cookie;
         uio.uio_resid = count;
 
         error = VOP_READDIR(vp, &uio, cr, &iseof, NULL, 0);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         if (error) {
                 kmem_free(data, count);
                 goto out;
         }

@@ -3728,20 +3408,12 @@
                 }
         }
 
         (void) VOP_RWLOCK(vp, V_WRITELOCK_FALSE, NULL);
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr) {
-                va.va_mask = AT_ALL;
-                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
         va.va_mask = AT_ALL;
         vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         if (vp->v_type != VDIR) {
                 error = ENOTDIR;
                 goto out;
         }

@@ -3896,23 +3568,13 @@
                 if (space_left >= DIRENT64_RECLEN(MAXNAMELEN))
                         goto getmoredents;
 
                 /* else, fall through */
         }
-
 good:
-
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         VOP_RWUNLOCK(vp, V_WRITELOCK_FALSE, NULL);
 
         infop = kmem_alloc(nents * sizeof (struct entryplus3_info), KM_SLEEP);
         resp->resok.infop = infop;

@@ -3936,40 +3598,24 @@
                         infop[i].fh.handle_follows = FALSE;
                         dp = nextdp(dp);
                         continue;
                 }
 
-#ifdef DEBUG
-                if (rfs3_do_post_op_attr) {
-                        nva.va_mask = AT_ALL;
-                        nvap = rfs4_delegated_getattr(nvp, &nva, 0, cr) ?
-                            NULL : &nva;
-                } else
-                        nvap = NULL;
-#else
                 nva.va_mask = AT_ALL;
                 nvap = rfs4_delegated_getattr(nvp, &nva, 0, cr) ? NULL : &nva;
-#endif
+
                 /* Lie about the object type for a referral */
                 if (vn_is_nfs_reparse(nvp, cr))
                         nvap->va_type = VLNK;
 
                 vattr_to_post_op_attr(nvap, &infop[i].attr);
 
-#ifdef DEBUG
-                if (!rfs3_do_post_op_fh3)
-                        infop[i].fh.handle_follows = FALSE;
-                else {
-#endif
                 error = makefh3(&infop[i].fh.handle, nvp, exi);
                 if (!error)
                         infop[i].fh.handle_follows = TRUE;
                 else
                         infop[i].fh.handle_follows = FALSE;
-#ifdef DEBUG
-                }
-#endif
 
                 VN_RELE(nvp);
                 dp = nextdp(dp);
         }
 

@@ -4104,20 +3750,12 @@
                 }
         }
 
         error = VFS_STATVFS(vp->v_vfsp, &sb);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         if (error)
                 goto out;
 
         resp->status = NFS3_OK;

@@ -4209,20 +3847,12 @@
                                 goto out;
                         }
                 }
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
-                va.va_mask = AT_ALL;
-                vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
         va.va_mask = AT_ALL;
         vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         resp->status = NFS3_OK;
         vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
         xfer_size = rfs3_tsize(req);
         resp->resok.rtmax = xfer_size;

@@ -4321,20 +3951,12 @@
                                 goto out1;
                         }
                 }
         }
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 va.va_mask = AT_ALL;
                 vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-        } else
-                vap = NULL;
-#else
-        va.va_mask = AT_ALL;
-        vap = VOP_GETATTR(vp, &va, 0, cr, NULL) ? NULL : &va;
-#endif
 
         error = VOP_PATHCONF(vp, _PC_LINK_MAX, &val, cr, NULL);
         if (error)
                 goto out;
         resp->resok.info.link_max = (uint32)val;

@@ -4422,18 +4044,11 @@
          * right access checking.  So, we'll fail the request.
          */
         if (error)
                 goto out;
 
-#ifdef DEBUG
-        if (rfs3_do_pre_op_attr)
-                bvap = &bva;
-        else
-                bvap = NULL;
-#else
         bvap = &bva;
-#endif
 
         if (rdonly(exi, req)) {
                 resp->status = NFS3ERR_ROFS;
                 goto out1;
         }

@@ -4463,20 +4078,12 @@
             (error = VOP_ACCESS(vp, VWRITE, 0, cr, NULL)))
                 goto out;
 
         error = VOP_FSYNC(vp, FSYNC, cr, NULL);
 
-#ifdef DEBUG
-        if (rfs3_do_post_op_attr) {
                 ava.va_mask = AT_ALL;
                 avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-        } else
-                avap = NULL;
-#else
-        ava.va_mask = AT_ALL;
-        avap = VOP_GETATTR(vp, &ava, 0, cr, NULL) ? NULL : &ava;
-#endif
 
         if (error)
                 goto out;
 
         resp->status = NFS3_OK;