Print this page
*** NO COMMENTS ***
        
*** 2597,2608 ****
          int pathflag;
          vnode_t *mc_dvp = NULL;
          vnode_t *realvp;
          int error;
  
-         *exi = NULL;
- 
          /*
           * check if the given path is a url or native path. Since p is
           * modified by MCLpath(), it may be empty after returning from
           * there, and should be checked.
           */
--- 2597,2606 ----
*** 2798,2809 ****
                           * for odd case where a directory is provided as index
                           * option argument and leads us to another filesystem
                           */
  
                          /* Release the reference on the old exi value */
-                         ASSERT(*exi != NULL);
                          exi_rele(*exi);
  
                          if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
                                  VN_RELE(*vpp);
                                  goto publicfh_done;
                          }
--- 2796,2807 ----
                           * for odd case where a directory is provided as index
                           * option argument and leads us to another filesystem
                           */
  
                          /* Release the reference on the old exi value */
                          exi_rele(*exi);
+                         *exi = NULL;
  
                          if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
                                  VN_RELE(*vpp);
                                  goto publicfh_done;
                          }
*** 2812,2821 ****
--- 2810,2822 ----
  
  publicfh_done:
          if (mc_dvp)
                  VN_RELE(mc_dvp);
  
+         if (error && *exi != NULL)
+                 exi_rele(*exi);
+ 
          return (error);
  }
  
  /*
   * Evaluate a multi-component path
*** 2957,2988 ****
  
  
  /*
   * Get the export information for the lookup vnode, and verify its
   * useable.
   */
  int
  nfs_check_vpexi(vnode_t *mc_dvp, vnode_t *vp, cred_t *cr,
!     struct exportinfo **exi)
  {
          int walk;
          int error = 0;
  
!         *exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
!         if (*exi == NULL)
                  error = EACCES;
          else {
                  /*
                   * If nosub is set for this export then
                   * a lookup relative to the public fh
                   * must not terminate below the
                   * exported directory.
                   */
!                 if ((*exi)->exi_export.ex_flags & EX_NOSUB && walk > 0)
                          error = EACCES;
          }
! 
          return (error);
  }
  
  /*
   * Do the main work of handling HA-NFSv4 Resource Group failover on
--- 2958,2995 ----
  
  
  /*
   * Get the export information for the lookup vnode, and verify its
   * useable.
+  *
+  * Set @exip only in success
   */
  int
  nfs_check_vpexi(vnode_t *mc_dvp, vnode_t *vp, cred_t *cr,
!     struct exportinfo **exip)
  {
          int walk;
          int error = 0;
+         struct exportinfo *exi;
  
!         exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
!         if (exi == NULL)
                  error = EACCES;
          else {
                  /*
                   * If nosub is set for this export then
                   * a lookup relative to the public fh
                   * must not terminate below the
                   * exported directory.
                   */
!                 if (exi->exi_export.ex_flags & EX_NOSUB && walk > 0) {
                          error = EACCES;
+                         exi_rele(exi);
                  }
!         }
!         if (error == 0)
!                 *exip = exi;
          return (error);
  }
  
  /*
   * Do the main work of handling HA-NFSv4 Resource Group failover on