Print this page
6093 zfsctl_shares_lookup should only VN_RELE() on zfs_zget() success
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ctldir.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ctldir.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
       24 + * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * ZFS control directory (a.k.a. ".zfs")
  28   29   *
  29   30   * This directory provides a common location for all ZFS meta-objects.
  30   31   * Currently, this is only the 'snapshot' directory, but this may expand in the
  31   32   * future.  The elements are built using the GFS primitives, as the hierarchy
  32   33   * does not actually exist on disk.
  33   34   *
↓ open down ↓ 925 lines elided ↑ open up ↑
 959  960  
 960  961          if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
 961  962                  ZFS_EXIT(zfsvfs);
 962  963                  return (0);
 963  964          }
 964  965  
 965  966          if (zfsvfs->z_shares_dir == 0) {
 966  967                  ZFS_EXIT(zfsvfs);
 967  968                  return (SET_ERROR(ENOTSUP));
 968  969          }
 969      -        if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0)
      970 +        if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
 970  971                  error = VOP_LOOKUP(ZTOV(dzp), nm, vpp, pnp,
 971  972                      flags, rdir, cr, ct, direntflags, realpnp);
      973 +                VN_RELE(ZTOV(dzp));
      974 +        }
 972  975  
 973      -        VN_RELE(ZTOV(dzp));
 974  976          ZFS_EXIT(zfsvfs);
 975  977  
 976  978          return (error);
 977  979  }
 978  980  
 979  981  /* ARGSUSED */
 980  982  static int
 981  983  zfsctl_snapdir_readdir_cb(vnode_t *vp, void *dp, int *eofp,
 982  984      offset_t *offp, offset_t *nextp, void *data, int flags)
 983  985  {
↓ open down ↓ 382 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX