Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs_server.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_server.c
↓ open down ↓ 2591 lines elided ↑ open up ↑
2592 2592   */
2593 2593  int
2594 2594  rfs_publicfh_mclookup(char *p, vnode_t *dvp, cred_t *cr, vnode_t **vpp,
2595 2595      struct exportinfo **exi, struct sec_ol *sec)
2596 2596  {
2597 2597          int pathflag;
2598 2598          vnode_t *mc_dvp = NULL;
2599 2599          vnode_t *realvp;
2600 2600          int error;
2601 2601  
2602      -        *exi = NULL;
2603      -
2604 2602          /*
2605 2603           * check if the given path is a url or native path. Since p is
2606 2604           * modified by MCLpath(), it may be empty after returning from
2607 2605           * there, and should be checked.
2608 2606           */
2609 2607          if ((pathflag = MCLpath(&p)) == -1)
2610 2608                  return (EIO);
2611 2609  
2612 2610          /*
2613 2611           * If pathflag is SECURITY_QUERY, turn the SEC_QUERY bit
↓ open down ↓ 179 lines elided ↑ open up ↑
2793 2791                          if (error)
2794 2792                                  goto publicfh_done;
2795 2793  
2796 2794                          /*
2797 2795                           * Found a valid vp for index "filename". Sanity check
2798 2796                           * for odd case where a directory is provided as index
2799 2797                           * option argument and leads us to another filesystem
2800 2798                           */
2801 2799  
2802 2800                          /* Release the reference on the old exi value */
2803      -                        ASSERT(*exi != NULL);
2804 2801                          exi_rele(*exi);
     2802 +                        *exi = NULL;
2805 2803  
2806 2804                          if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
2807 2805                                  VN_RELE(*vpp);
2808 2806                                  goto publicfh_done;
2809 2807                          }
2810 2808                  }
2811 2809          }
2812 2810  
2813 2811  publicfh_done:
2814 2812          if (mc_dvp)
2815 2813                  VN_RELE(mc_dvp);
2816 2814  
     2815 +        if (error && *exi != NULL)
     2816 +                exi_rele(*exi);
     2817 +
2817 2818          return (error);
2818 2819  }
2819 2820  
2820 2821  /*
2821 2822   * Evaluate a multi-component path
2822 2823   */
2823 2824  int
2824 2825  rfs_pathname(
2825 2826          char *path,                     /* pathname to evaluate */
2826 2827          vnode_t **dirvpp,               /* ret for ptr to parent dir vnode */
↓ open down ↓ 125 lines elided ↑ open up ↑
2952 2953                  }
2953 2954                  q++;
2954 2955          }
2955 2956          *q = '\0';
2956 2957  }
2957 2958  
2958 2959  
2959 2960  /*
2960 2961   * Get the export information for the lookup vnode, and verify its
2961 2962   * useable.
     2963 + *
     2964 + * Set @exip only in success
2962 2965   */
2963 2966  int
2964 2967  nfs_check_vpexi(vnode_t *mc_dvp, vnode_t *vp, cred_t *cr,
2965      -    struct exportinfo **exi)
     2968 +    struct exportinfo **exip)
2966 2969  {
2967 2970          int walk;
2968 2971          int error = 0;
     2972 +        struct exportinfo *exi;
2969 2973  
2970      -        *exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
2971      -        if (*exi == NULL)
     2974 +        exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
     2975 +        if (exi == NULL)
2972 2976                  error = EACCES;
2973 2977          else {
2974 2978                  /*
2975 2979                   * If nosub is set for this export then
2976 2980                   * a lookup relative to the public fh
2977 2981                   * must not terminate below the
2978 2982                   * exported directory.
2979 2983                   */
2980      -                if ((*exi)->exi_export.ex_flags & EX_NOSUB && walk > 0)
     2984 +                if (exi->exi_export.ex_flags & EX_NOSUB && walk > 0) {
2981 2985                          error = EACCES;
     2986 +                        exi_rele(exi);
     2987 +                }
2982 2988          }
2983      -
     2989 +        if (error == 0)
     2990 +                *exip = exi;
2984 2991          return (error);
2985 2992  }
2986 2993  
2987 2994  /*
2988 2995   * Do the main work of handling HA-NFSv4 Resource Group failover on
2989 2996   * Sun Cluster.
2990 2997   * We need to detect whether any RG admin paths have been added or removed,
2991 2998   * and adjust resources accordingly.
2992 2999   * Currently we're using a very inefficient algorithm, ~ 2 * O(n**2). In
2993 3000   * order to scale, the list and array of paths need to be held in more
↓ open down ↓ 361 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX