From 7fdd2bf7d423c38f79b79318e9352e522722aeca Mon Sep 17 00:00:00 2001 From: Christos Longros <98426896+chrislongros@users.noreply.github.com> Date: Mon, 20 Apr 2026 19:02:26 +0200 Subject: [PATCH] libzfs: report permission error from umount helper Non-root callers got "unmount failed" when ZFS_MOUNT_HELPER was set because /bin/umount's exit status doesn't preserve errno. Map a non-zero helper exit to EPERM when geteuid() != 0 so the user sees "permission denied". Reviewed-by: Brian Behlendorf Signed-off-by: Christos Longros Closes #11740 Closes #18443 --- lib/libzfs/os/linux/libzfs_mount_os.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libzfs/os/linux/libzfs_mount_os.c b/lib/libzfs/os/linux/libzfs_mount_os.c index 7d8768d12dda..991ef3dfbb94 100644 --- a/lib/libzfs/os/linux/libzfs_mount_os.c +++ b/lib/libzfs/os/linux/libzfs_mount_os.c @@ -406,7 +406,11 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags) argv[count] = (char *)mntpt; rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE); - return (rc ? EINVAL : 0); + if (rc == 0) + return (0); + if (rc > 0 && geteuid() != 0) + return (EPERM); + return (EINVAL); } #ifdef HAVE_MOUNT_SETATTR