comparison usr/src/uts/common/fs/nfs/nfs_server.c @ 13814:829c00a55a37

2986 nfs: exi refcounter leak at rfs3_lookup Reviewed by: Albert Lee <trisk@nexenta.com> Reviewed by: Gordon Ross <gwr@nexenta.com> Approved by: Albert Lee <trisk@nexenta.com>
author Vitaliy Gusev <gusev.vitaliy@nexenta.com>
date Wed, 22 Aug 2012 13:03:31 +0000
parents bf40125f4b37
children ad441dd34478
comparison
equal deleted inserted replaced
13813:57f9d55c2a31 13814:829c00a55a37
19 * CDDL HEADER END 19 * CDDL HEADER END
20 */ 20 */
21 /* 21 /*
22 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. 22 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011 Bayard G. Bell. All rights reserved. 23 * Copyright (c) 2011 Bayard G. Bell. All rights reserved.
24 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 */ 25 */
25 26
26 /* 27 /*
27 * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T. 28 * Copyright (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
28 * All rights reserved. 29 * All rights reserved.
2798 * for odd case where a directory is provided as index 2799 * for odd case where a directory is provided as index
2799 * option argument and leads us to another filesystem 2800 * option argument and leads us to another filesystem
2800 */ 2801 */
2801 2802
2802 /* Release the reference on the old exi value */ 2803 /* Release the reference on the old exi value */
2803 ASSERT(*exi != NULL);
2804 exi_rele(*exi); 2804 exi_rele(*exi);
2805 *exi = NULL;
2805 2806
2806 if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) { 2807 if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
2807 VN_RELE(*vpp); 2808 VN_RELE(*vpp);
2808 goto publicfh_done; 2809 goto publicfh_done;
2809 } 2810 }
2811 } 2812 }
2812 2813
2813 publicfh_done: 2814 publicfh_done:
2814 if (mc_dvp) 2815 if (mc_dvp)
2815 VN_RELE(mc_dvp); 2816 VN_RELE(mc_dvp);
2817
2818 if (error && *exi != NULL)
2819 exi_rele(*exi);
2816 2820
2817 return (error); 2821 return (error);
2818 } 2822 }
2819 2823
2820 /* 2824 /*
2957 2961
2958 2962
2959 /* 2963 /*
2960 * Get the export information for the lookup vnode, and verify its 2964 * Get the export information for the lookup vnode, and verify its
2961 * useable. 2965 * useable.
2966 *
2967 * Set @exip only in success
2962 */ 2968 */
2963 int 2969 int
2964 nfs_check_vpexi(vnode_t *mc_dvp, vnode_t *vp, cred_t *cr, 2970 nfs_check_vpexi(vnode_t *mc_dvp, vnode_t *vp, cred_t *cr,
2965 struct exportinfo **exi) 2971 struct exportinfo **exip)
2966 { 2972 {
2967 int walk; 2973 int walk;
2968 int error = 0; 2974 int error = 0;
2969 2975 struct exportinfo *exi;
2970 *exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE); 2976
2971 if (*exi == NULL) 2977 exi = nfs_vptoexi(mc_dvp, vp, cr, &walk, NULL, FALSE);
2978 if (exi == NULL)
2972 error = EACCES; 2979 error = EACCES;
2973 else { 2980 else {
2974 /* 2981 /*
2975 * If nosub is set for this export then 2982 * If nosub is set for this export then
2976 * a lookup relative to the public fh 2983 * a lookup relative to the public fh
2977 * must not terminate below the 2984 * must not terminate below the
2978 * exported directory. 2985 * exported directory.
2979 */ 2986 */
2980 if ((*exi)->exi_export.ex_flags & EX_NOSUB && walk > 0) 2987 if (exi->exi_export.ex_flags & EX_NOSUB && walk > 0) {
2981 error = EACCES; 2988 error = EACCES;
2982 } 2989 exi_rele(exi);
2983 2990 }
2991 }
2992 if (error == 0)
2993 *exip = exi;
2984 return (error); 2994 return (error);
2985 } 2995 }
2986 2996
2987 /* 2997 /*
2988 * Do the main work of handling HA-NFSv4 Resource Group failover on 2998 * Do the main work of handling HA-NFSv4 Resource Group failover on