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;
         }

@@ -455,20 +429,29 @@
         if (name == NULL) {
                 resp->status = NFS3ERR_ACCES;
                 goto out1;
         }
 
+        exi_hold(exi);
+
         /*
          * If the public filehandle is used then allow
          * a multi-component lookup
          */
         if (PUBLIC_FH3(&args->what.dir)) {
+                struct exportinfo *new;
+
                 publicfh_flag = TRUE;
+
                 error = rfs_publicfh_mclookup(name, dvp, cr, &vp,
-                    &exi, &sec);
-                if (error && exi != NULL)
-                        exi_rele(exi); /* See comment below Re: publicfh_flag */
+                    &new, &sec);
+
+                if (error == 0) {
+                        exi_rele(exi);
+                        exi = new;
+                }
+
                 /*
                  * Since WebNFS may bypass MOUNT, we need to ensure this
                  * request didn't come from an unlabeled admin_low client.
                  */
                 if (is_system_labeled() && error == 0) {

@@ -486,12 +469,10 @@
                         }
                         tp = find_tpc(ipaddr, addr_type, B_FALSE);
                         if (tp == NULL || tp->tpc_tp.tp_doi !=
                             l_admin_low->tsl_doi || tp->tpc_tp.host_type !=
                             SUN_CIPSO) {
-                                if (exi != NULL)
-                                        exi_rele(exi);
                                 VN_RELE(vp);
                                 resp->status = NFS3ERR_ACCES;
                                 error = 1;
                         }
                         if (tp != NULL)

@@ -503,39 +484,35 @@
         }
 
         if (name != args->what.name)
                 kmem_free(name, MAXPATHLEN + 1);
 
+        if (error == 0 && vn_ismntpt(vp)) {
+                error = rfs_cross_mnt(&vp, &exi);
+                if (error)
+                        VN_RELE(vp);
+        }
+
         if (is_system_labeled() && error == 0) {
                 bslabel_t *clabel = req->rq_label;
 
                 ASSERT(clabel != NULL);
                 DTRACE_PROBE2(tx__rfs3__log__info__oplookup__clabel, char *,
                     "got client label from request(1)", struct svc_req *, req);
 
                 if (!blequal(&l_admin_low->tsl_label, clabel)) {
                         if (!do_rfs_label_check(clabel, dvp,
                             DOMINANCE_CHECK, exi)) {
-                                if (publicfh_flag && exi != NULL)
-                                        exi_rele(exi);
                                 VN_RELE(vp);
                                 resp->status = NFS3ERR_ACCES;
                                 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) {

@@ -549,30 +526,14 @@
         if (error) {
                 VN_RELE(vp);
                 goto out;
         }
 
-        /*
-         * If publicfh_flag is true then we have called rfs_publicfh_mclookup
-         * and have obtained a new exportinfo in exi which needs to be
-         * released. Note the the original exportinfo pointed to by exi
-         * 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
 
+        exi_rele(exi);
         VN_RELE(vp);
 
         resp->status = NFS3_OK;
         vattr_to_post_op_attr(vap, &resp->resok.obj_attributes);
         vattr_to_post_op_attr(dvap, &resp->resok.dir_attributes);

@@ -590,10 +551,16 @@
         VN_RELE(dvp);
 
         return;
 
 out:
+        /*
+         * The passed argument exportinfo is released by the
+         * caller, common_dispatch
+         */
+        exi_rele(exi);
+
         if (curthread->t_flag & T_WOULDBLOCK) {
                 curthread->t_flag &= ~T_WOULDBLOCK;
                 resp->status = NFS3ERR_JUKEBOX;
         } else
                 resp->status = puterrno3(error);

@@ -660,16 +627,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 +702,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 +768,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 +836,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 +1017,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 +1167,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 +1344,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 +1455,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 +1543,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 +1707,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 +1812,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 +1900,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 +1961,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 +2049,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 +2122,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 +2145,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 +2225,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 +2328,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 +2341,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 +2417,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 +2494,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 +2561,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 +2615,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 +2717,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 +2740,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 +2843,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 +2928,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 +2966,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 +3013,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 +3145,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 +3186,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 +3417,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 +3577,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 +3607,29 @@
                         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;
 
+                if (vn_ismntpt(nvp)) {
+                        infop[i].attr.attributes = FALSE;
+                        infop[i].fh.handle_follows = FALSE;
+                } else {
                 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 +3764,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 +3861,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 +3965,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 +4058,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 +4092,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;