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>

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 
 /*
  * ZFS control directory (a.k.a. ".zfs")
  *

@@ -964,15 +965,16 @@
 
         if (zfsvfs->z_shares_dir == 0) {
                 ZFS_EXIT(zfsvfs);
                 return (SET_ERROR(ENOTSUP));
         }
-        if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0)
+        if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
                 error = VOP_LOOKUP(ZTOV(dzp), nm, vpp, pnp,
                     flags, rdir, cr, ct, direntflags, realpnp);
-
         VN_RELE(ZTOV(dzp));
+        }
+
         ZFS_EXIT(zfsvfs);
 
         return (error);
 }