Print this page
*** NO COMMENTS ***

@@ -2597,12 +2597,10 @@
         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.
          */

@@ -2798,12 +2796,12 @@
                          * 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);
+                        *exi = NULL;
 
                         if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
                                 VN_RELE(*vpp);
                                 goto publicfh_done;
                         }

@@ -2812,10 +2810,13 @@
 
 publicfh_done:
         if (mc_dvp)
                 VN_RELE(mc_dvp);
 
+        if (error && *exi != NULL)
+                exi_rele(*exi);
+
         return (error);
 }
 
 /*
  * Evaluate a multi-component path

@@ -2957,32 +2958,38 @@
 
 
 /*
  * 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 **exi)
+    struct exportinfo **exip)
 {
         int walk;
         int error = 0;
+        struct exportinfo *exi;
 
-        *exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
-        if (*exi == NULL)
+        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)
+                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