From 217f48373f9878a3cd714b8007444f46101aad9e Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Sat, 11 Jul 2020 20:16:13 -0400 Subject: libzfs: Add error message for why creating mountpoint failed When zfs_mount_at() fails to stat the mountpoint and can't create the directory, we return an error with a message "failed to create mountpoint" but there is no indication why it failed. Add the error string from the syscall to the error aux message. Update do_mount for Linux to return the errno instead of -1. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10550 --- lib/libzfs/os/linux/libzfs_mount_os.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/libzfs/os/linux') diff --git a/lib/libzfs/os/linux/libzfs_mount_os.c b/lib/libzfs/os/linux/libzfs_mount_os.c index 04252e421..7be85097d 100644 --- a/lib/libzfs/os/linux/libzfs_mount_os.c +++ b/lib/libzfs/os/linux/libzfs_mount_os.c @@ -569,7 +569,9 @@ do_mount(zfs_handle_t *zhp, const char *mntpt, char *opts, int flags) } strlcat(myopts, opts, MNT_LINE_MAX); zfs_adjust_mount_options(zhp, mntpt, myopts, NULL); - error = mount(src, mntpt, MNTTYPE_ZFS, mntflags, myopts); + if (mount(src, mntpt, MNTTYPE_ZFS, mntflags, myopts)) { + return (errno); + } } else { char *argv[9] = { "/bin/mount", -- cgit v1.2.3