diff options
author | Andrew Stormont <astormont@racktopsystems.com> | 2017-02-12 00:33:35 +0000 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2017-02-19 12:56:04 -0500 |
commit | ff524b2355c0ac08bf963297ae8e5ea2e8375852 (patch) | |
tree | 08388bee27058646fa1665f217c4f37388893672 | |
parent | 7199b8e79a66167b9224eed40ed9bd8effcc49a8 (diff) | |
download | illumos-joyent-ff524b2355c0ac08bf963297ae8e5ea2e8375852.tar.gz |
7857 zfs/zpool commands print scary errors after 7741
7887 get_zfs_dataset() optimised path leaks zfs handle
Reviewed by: Sam Zaydel <szaydel@racktopsystems.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r-- | usr/src/lib/libshare/common/libshare_zfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr/src/lib/libshare/common/libshare_zfs.c b/usr/src/lib/libshare/common/libshare_zfs.c index ec465295b1..08b5a00e9d 100644 --- a/usr/src/lib/libshare/common/libshare_zfs.c +++ b/usr/src/lib/libshare/common/libshare_zfs.c @@ -25,6 +25,7 @@ /* * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, 2016 by Delphix. All rights reserved. + * Copyright 2017 RackTop Systems. */ #include <stdio.h> @@ -336,11 +337,20 @@ get_zfs_dataset(sa_handle_impl_t impl_handle, char *path, cutpath = path + strspn(path, "/"); assert(impl_handle->zfs_libhandle != NULL); + libzfs_print_on_error(impl_handle->zfs_libhandle, B_FALSE); if ((handle_from_path = zfs_open(impl_handle->zfs_libhandle, cutpath, - ZFS_TYPE_FILESYSTEM)) != NULL) + ZFS_TYPE_FILESYSTEM)) != NULL) { if ((ret = verify_zfs_handle(handle_from_path, path, - search_mnttab)) != NULL) + search_mnttab)) != NULL) { + zfs_close(handle_from_path); + libzfs_print_on_error(impl_handle->zfs_libhandle, + B_TRUE); return (ret); + } + zfs_close(handle_from_path); + } + libzfs_print_on_error(impl_handle->zfs_libhandle, B_TRUE); + /* * Couldn't find a filesystem optimistically, check all the handles we * can. |