svn commit: r351168 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Andriy Gapon avg at FreeBSD.org
Sat Aug 17 09:23:04 UTC 2019


Author: avg
Date: Sat Aug 17 09:23:03 2019
New Revision: 351168
URL: https://svnweb.freebsd.org/changeset/base/351168

Log:
  zfs_vget: fix vnode reference count leak in error path
  
  If vn_lock() failed, then the function returned the error but the vnode
  obtained via zfs_zget() was never released.
  
  MFC after:	10 days
  Sponsored by:	Panzura

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Sat Aug 17 08:29:22 2019	(r351167)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Sat Aug 17 09:23:03 2019	(r351168)
@@ -2317,8 +2317,11 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **
 	if (err == 0)
 		*vpp = ZTOV(zp);
 	ZFS_EXIT(zfsvfs);
-	if (err == 0)
+	if (err == 0) {
 		err = vn_lock(*vpp, flags);
+		if (err != 0)
+			vrele(*vpp);
+	}
 	if (err != 0)
 		*vpp = NULL;
 	return (err);


More information about the svn-src-all mailing list