From d41856a8996d20c3d1a206a4dfbe10f9373b54f4 Mon Sep 17 00:00:00 2001 From: Rich Ercolani Date: Sun, 28 Nov 2021 17:13:58 -0500 Subject: [PATCH] Stop segfaulting on unmount error case After interrupting ZTS runs that errored out, I found that "zpool export testpool2" was segfaulting. This seems unnecessary. Signed-off-by: Rich Ercolani --- lib/libzfs/libzfs_mount.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index b0279d8fbc3f..e97de8f20262 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -595,9 +595,13 @@ unmount_one(zfs_handle_t *zhp, const char *mountpoint, int flags) default: libzfs_err = EZFS_UMOUNTFAILED; } - return (zfs_error_fmt(zhp->zfs_hdl, libzfs_err, - dgettext(TEXT_DOMAIN, "cannot unmount '%s'"), - mountpoint)); + if (zhp) { + return (zfs_error_fmt(zhp->zfs_hdl, libzfs_err, + dgettext(TEXT_DOMAIN, "cannot unmount '%s'"), + mountpoint)); + } else { + return (-1); + } } return (0);