Skip to content

Commit

Permalink
Stop segfaulting on unmount error case
Browse files Browse the repository at this point in the history
After interrupting ZTS runs that errored out, I found that
"zpool export testpool2" was segfaulting.

This seems unnecessary.

Reviewed-by: szubersk <szuberskidamian@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#12804
  • Loading branch information
rincebrain authored and nicman23 committed Aug 22, 2022
1 parent 5fa7b7a commit 2fe1a67
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2fe1a67

Please sign in to comment.